Editing & Navigation

This page is just a reference for your convenience. You are not expected to memorize what’s listed here.

Key Description
h Move left
j Move down
k Move up
l Move right, (‘l’ for ‘letter’)
Key Description
w Forward one word, start at next word
e Forward one word, stop at end of current word
b Back to nearest word start
Key Description
W Same as w, but only use spaces for a word boundaries
E Same as e, but only use spaces for a word boundaries
B Same as b, but only use spaces for a word boundaries
Key Description
f<letter> Move cursor on top of next instance of <letter> in current line
t<letter> Move cursor right before next instance of <letter> in current line
F<letter> Move cursor on top of previous instance of <letter> in current line
T<letter> Move cursor right before previous instance of <letter> in current line
Key Description
gg Top of file
G Bottom of file
:20 Line 20 of file
} Skip to next empty line
Key Description
0 Go to start of line
^ Go to first non-whitespace character of line
$ Go to end of line
% Go to matching paren or brace

Inserting

Key Description
i Insert right before current character
a Insert right after current character
I Insert at the beginning of the line (skipping whitespace)
A Insert at the end of the line
o Insert new line below this line
O Insert new line above this line

Editing

Key Description
d Delete
dd Delete the entire line
c “Change”: delete and enter insert mode
cc Change the entire line

Operators & Motions

Operators can be combined with motions to operate on a certain hunk of text.

Key Description
cw Change one word
ct) Change until the next )
df. Delete everything up to and including .
d4l Delete the next four letters
d} Delete until the next empty line

More

Each Vim resource is a little bit different. Another one you may want to look at is Vim Cheatsheet.

Copyright © 2014, Great Practical Ideas in Computer Science.