vim cheatsheet

September 18th, 2008  |  Published in note to self, Recipes  |  2 Comments

Extracting from a vimball

From http://vim.sourceforge.net/scripts/script.php?script_id=1502

Users of a vimball archive simply need to

:vim something.vba
:so %

and the contents of the vimball will be extracted and placed into the proper directories, no matter where the user opened up the vimball. Furthermore, the helptags command will be automatically and transparently used to make any doc/*.txt files’ contents available by the Vim help system.

Getting the filename of the currently edited file

From http://rayninfo.co.uk/vimtips.html:

:!echo %:p                        : full path & file name
:!echo %:p:h                      : full path only
:!echo %:t                        : filename only

Removing empty lines

From Vim Tip 72:

 :g/^$/d

Converting select text to lowercase

In visual mode, select text.  Then type the u key.