Some handy vim commands
Posted on June 20, 2007 in Vim
I want to have them in one place so i write them down here:
:g/^#/d Delete all lines that begins with #
:g/^$/d Delete all lines that are empty and contain no tabs
:g/^\s*$/d Delete all lines that are empty
:%s/$/{ctrl-V}{CR}/g Inserts blank line between lines
:%s/{TAB}*$// Strip tabs at end of line
:g/<pattern>/t$ Copy every line which matches pattern to the end of the file
5>> indent 5 lines from line where cursor stands, handy because you dont need to enter visual mode
And yes, {ctrl-V},{CR} and {TAB} means you have to press it, not to type it.
Credits go to gentoo- wiki.com, yolinux.com and www.int-x.org