Posted on January 28, 2009
To reverse the order of lines, eg 1-5 : 1,5 g/^/m0 For example,
: 1,5 g/^/m0
one two three four five
becomes
five four three two one
To remove blank lines : %g/^$/d
: %g/^$/d
Delete all lines that don’t contain “string” : %v/string/d
: %v/string/d
Categories: vim, xhtml
Tags: vim
Nice! I love vim, I wish you would explain how the lines switching one works but ah well.
Part 2 coming?
Your email address will not be published. Required fields are marked *
Name *
Email *
Website
Comment
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Notify me of follow-up comments by email.
Notify me of new posts by email.
Nice! I love vim, I wish you would explain how the lines switching one works but ah well.
Part 2 coming?