Vim Tip: Sort Lines Alphabetically

Have a list that you need to alphabetize quickly? Vim has you covered. There’s a handy :sort command (:help sort for optional arguments) that will do just what it says on the box. All you have to do is select the lines in visual mode (v), and run :sort.

vim :sort

What sort of arguments does it support? The most common are probably ! and i, which reverse the sort order and ignore case, respectively. It supports some more advanced pattern-matching stuff, but I haven’t had cause to experiment with it yet.

  • http://www.webmaisterpro.com/ Kaloyan Banev

    VIM is one of the most powerful IDEs. It is not as polished as the others, but it is extremely flexible and platform independent.