Stupid VIM tricks


Multiple yank buffers.

The way this is used is by preceeding a yank/paste command with "(buffer key). That is: the double quote key, and then any other key. The latter key is the buffer you are yanking into. You refer to this same buffer when you want to paste.

For example: ayy (yanks the current line into both the 'a' buffer and the default buffer) jjyy (moves down two lines and yanks that line into the default buffer) aP (pastes the contents of the "a" buffer after the current line)


Block indenting.

In UltraEdit (for Win32) you could select a block of text and then use tab/shift-tab to indent/unindent it. In vim, this is accomplished with the >/< keys.

Use it with a movement to do blocks of text.

For example: >] (indents the paragraph)


Reformatting paragraphs.

I forget how to get VIM to format paragraphs nicely by default. But even then, it can sometimes get whack. You can force it to reformat by using "gq-(motion command)"

For example: gq] (reformats the paragraph)


Searches are movements.

You can use a search (using "/" or "?") as a movement.

For example: d/> (delete to the end of a tag), and d/} (delete to the first curly)