Last Updated: September 26, 2017
· bchretien

Vim: sorting a block of text

For Vim beginners, here's how you can easily sort a block of text:

<a href="" target="_blank">sort</a>


vip: visual-select the inner paragraph

:sort: sort the selected text. This will default to alphabetical order. Note that after selecting the text and typing :, your command will be prefixed by :'<,'>. This part is related to the selection. If you simply run the :sort command (without the prefix), the whole file will be sorted.