Thursday, October 14, 2010

sorting lines with vim

For e.g.

test.txt : 
z
y
x
w
v
u

If I say ->
:1,4 sort

test.txt will become
w
x
y
z
u
v

:.,+3 sort
will sort from current line to current line + 3.

:1,$ sort u
will sort and remove duplicates

To sort in reverse,
sort!

PS: This functionality doesn't work with IntelliJ Idea's vim plugin

No comments:

Blog Archive