How do I sort selected lines numerically in visual mode using the first number on each line?
Plain :sort n is useful, but it only works when the numeric key starts at the beginning of each line.
category:
visual-mode
tags:
#visual-mode
#sorting
#ex-commands
#text-processing
How do I sort only a visual selection using a fixed virtual column as the key?
When lines contain aligned columns, plain :sort often gives the wrong order because it compares from column 1.
category:
visual-mode
tags:
#visual-mode
#sorting
#text-processing
#command-line
How do I sort lines using only the text under a visual column?
When you need to sort records by a substring that starts at a visual column, Vim can do it without external tools.
category:
visual-mode
tags:
#visual-mode
#sorting
#ex-commands
#text-processing
How do I sort lines by a secondary field while ignoring a common leading prefix?
The :[range]sort /regex/ command sorts lines while skipping the portion of each line that matches the regex.
category:
command-line
tags:
#ex-commands
#sorting
#command-line
#search
How do I sort lines within a visual selection in reverse alphabetical order?
The sort! command sorts the selected lines in reverse (descending) order.
category:
visual-mode
tags:
#visual-mode
#sorting
#ex-commands
#editing
How do I sort lines in reverse numerical order in Vim?
The :sort! n command sorts the lines of a buffer (or a range) by their numeric value in descending order.
category:
editing
tags:
#editing
#ex-commands
#sorting
How do I sort lines by a field in the middle or end of each line using a pattern?
The :sort r /{pattern}/ command sorts lines using the text that matches the pattern as the sort key.
category:
command-line
tags:
#command-line
#sorting
#ex-commands
#regex
How do I sort lines by a specific column or field in Vim?
Vim does not have a built-in multi-column sort, but you can leverage the external sort command to sort selected lines by any field.
category:
editing
tags:
#editing
#sorting
#ex-commands
#external-commands
#command-line