45
7
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
45
7
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
62
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.
What's different between :%sort i
and :sort i
? – Deqing – 2018-07-05T05:16:39.927
1No fundamental difference. The former is explicit about the range on which it operates on while the latter is implicit. – romainl – 2018-07-05T08:03:46.033
what about to use
sort -f
eventually redirecting output to a new filesort -f old_file > new_file
? – Hastur – 2014-08-07T13:32:21.423I assume you mean case sensitive in the first one? – FDinoff – 2014-08-07T23:40:18.943
@FDinoff, yep, thanks for reporting the typo :) – sampablokuper – 2014-08-10T00:23:46.853