VIM keybindings

Some commonly used vim keybindings


Moving around

hMove left
jMove down
kMove up
lMove right
 
CTRL-uMove up half a page
CTRL-dMove down half a page
 
CTRL-w If split screen then move to screen above
CTRL-w If split screen then move to screen below
 
wMove one word to the right
bMove one word to the left
 
0 (zero)Move to begin of line
$Move to end of line
nGMove to specified linenumber, where n is the line number.
%Jump to matching item '([{}])'.
 

Cursor movement

zzDisplay the line your cursor is at in the middle of the screen.
zt,, top of the screen
zb,, bottom of the screen
 

Deleting, Copying, Pasting and Repeating

ddDelete a line
dwDelete a word
d$ or DDelete to end of line
d^Delete to begin of line
yyYank (copy) line into register
ywYank (copy) word into register
pPaste deleted line
:puPaste block after current line
. (dot)Repeat last change, a count can be used like '3.'
 

Search and Replace

/Start searching forward
?,, backwards
*Search the word your cursor is at, forward
#,, backwards
nFind next
Shift-NFind previous
:%s/four/4/gReplace all occurences of 'four' with '4'
gdMark all selected variables (global declaration) and go to the declaration.
 

Modes

iStart 'INSERT' mode
aStart 'APPEND' mode
rStart 'REPLACE' single character mode
RStart 'REPLACE' mode
oStart 'INSERT' on new line below current line
OStart 'INSERT' on new line above current line
Return to command mode
 

Other

:nohTurn off highlight
:wSave file
:qQuit vim
:wq,,
:e[dit]Edit a new file
 
:sp[lit]Split window
:bdClose file (buffer delete)
:%bdClose all buffers including and after this buffer
:clo[se]Close current (split)window
:ha[rdcopy]Send file to printer
:e ++ff=[unix|mac|dos]Force VIM to edit with the specified file format

Last Updated on August 15, 2005