Vim: sorting a block of text
For Vim beginners, here's how you can easily sort a block of text:
<a href="http://i.imgur.com/pa0eOGG.gif" target="_blank"></a>
Details
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.
Written by Benjamin Chrétien
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#