notes on vim

notes on vim

This is just a dump of things I discovered as I used them. I often find "my vim tricks" page and I always take the time to go through all the commands. I always something new, so I decided to do the same and dump here all the things I discover on vim. Last update: 2009-08-13

snipMate

This is an awesome plugin for VIM that uses the smart and convenient format from TextMate to store templates. I am usually conservative concerning plugins but this one is a must have for people writing a ton of code. You can find it on vim.org and google code.

commands

gq
Align/format the text in visual mode.
zj, zk
Move between the different foldings.
za, zi
Toggle folding under the cursor, and on the whole document.
< and >
Indent in and out (use . to repeat)
.
Repeat the last command
Ctrl-o
Allow to make one keystoke in command mode and go back in insert mode.
o and O
Add a new line after/before the current line and start insert mode.
"*y and "*p
Copy/Paste in the system clipboard (even between VMs or VNC).
'.
Go back to the last edited place.
Ctrl-[
I got used to use that instead of Escape, it's much closer to the home row.
H, M and L
Move the cursor on the top, middle and bottom of the current screen.
viw, ciw, diw
Select, replace or delete the word under the cursor.
zz
Center the screen on the current cursor position.
ZZ
Save and exit.
Bertrand Janin <tamentis@neopulsar.org> · Powered by Python & Debian GNU/Linux