How to sort in vim starting at some column / character
The following vim command helped me:
:sort /\%5v/
Description
besides some simple options (for example, u, i,!, n) the sorting can get the regular expression / {pattern} /. In this case, there are two options:
A. Sort by Skip
by default - without the [r] flag set, in this case, for each line, the text matched with the {pattern} is skipped, so sorting is performed by what happens after the match .
Examples from the documentation:
A1. Example - sorting starting from virtual column 5 our case is sorting by text in virtual column 5 (thus ignoring the difference between tabs and spaces):
:sort /.*\%5v/
A2. Example - sorting by second comma separated field
The logic is this: skip the text until the first comma is found:
:sort /[^,]*,/
B. Sort only matched - specified flag [r]
i.e. sorting is done by matching {pattern} instead of skipping past it as described above ... sort only the first three letters of each line:
:sort /\a\a\a/ r
Link
Please check : help: sort for more details / options
source to share