Today I Learned

hashrocket A Hashrocket project

Reverse sort lines in Vim

Vim provides sort command for ordering lines in an ascending order, but what if you want to sort the lines in a reverse order?

Linux's tail to the rescue!

First select the lines to be reversed in visual mode with V (big V) then execute this Linux command from Vim's command prompt:

:'<,'>!tail -r

demo

See More #vim TILs
Every developer at Hashrocket is a Vim expert. Check out our development environment, Dotmatrix, and if you are in Chicago, come to the Vim Chicago Meetup hosted at our Chicago office.