Suppose I have this section in my yaml file
hdkkhj50599: 1000000
504sdaaf54: 00000054
pppppp: 00005464
I want to sort these lines based on the values after colons.
None of the suggested solutions in stackoverflow worked for me.
How do I do it?
Vim's internal :sort provides options for what you want: the n flag is for sorting decimal numbers (instead of alphabetially, though it wouldn't matter in your 0-padded example), a /.../ pattern is skipped at the beginning; we non-greedily match up to the first colon and whitespace:
:sort n/.\{-}: /
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With