Not Amused
Not Amused

Reputation: 962

Sorting lines with vim by lines chunk

Can I sort lines in vim depending on a part of line and not the complete line? e.g

My Name is Deus Deceit

I would like to sort depending on the column that the name starts + 6 columns for example sort by column 19-25 and vim will only check those characters for sorting. If it can be done without a plugin that would be great. ty

Upvotes: 3

Views: 995

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172648

Check out :help :sort. The command takes an options {pattern} whose matched text is skipped (i.e. sorting happens after the match.

For example, to sort by column 19+ (see :help /\%c and the related regexp atoms):

:sort /.*\%19c/

Upvotes: 7

Related Questions