Case insensitive sorting

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

Solution 1:

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.