Case insensitive sorting
10,895
Vim's own :sort
command
:%sort i
does what you want.
See :help :sort
.
Alternatively, you can also use your system's sort
command as a filter:
:%!sort -f
See :help filter
in Vim and $ man sort
in your shell.
Related videos on Youtube
Author by
Oliver Salzburg
Updated on September 18, 2022Comments
-
Oliver Salzburg over 1 year
Vim's default sort is case sensitive, and produces results like this:
A B a
How can it be made case-insensitive, to produce the following result given the same input?
A a B
-
Hastur almost 10 yearswhat about to use
sort -f
eventually redirecting output to a new filesort -f old_file > new_file
? -
FDinoff almost 10 yearsI assume you mean case sensitive in the first one?
-
-
Deqing almost 6 yearsWhat's different between
:%sort i
and:sort i
? -
romainl almost 6 yearsNo fundamental difference. The former is explicit about the range on which it operates on while the latter is implicit.