| Cmd | Note | 
|---|---|
| Activating Modes | |
i | 
activate insert mode | 
I | 
move cursor to beginning of line and activate insert mode | 
a | 
move cursor forward one and activate insert mode | 
A | 
append - move to end of line and activate insert mode | 
r | 
replace single character | 
R | 
activate replace mode | 
v | 
activate highlight (visual) mode | 
| Basic Editing | |
x | 
delete single character | 
~ | 
switch case of selected | 
dw | 
delete word | 
d$ | 
delete to end of line | 
dd | 
delete current line | 
D | 
clear line without removing line | 
o | 
add line beneath cursor | 
O | 
add line above cursor | 
>> | 
indent curent line | 
y | 
copy (highlighted text) | 
yy | 
copy full line | 
p | 
put, paste last deleted content from d, x, or y action | 
u | 
undo last change | 
ctrl-r | 
redo | 
| Cool combos | |
xp | 
switch letters, the cursor letter with the one following it | 
ea | 
append word | 
v$ | 
highlight rest of line | 
yw | 
copy current word | 
yykp | 
copy and paste line above it | 
cw | 
delete current word and activate insert mode | 
g;, g, | 
go back, forward through changelist | 
gi | 
move to last place inserted text | 
vib | 
select everything in current parenthesis | 
viB | 
select everything in current braces | 
veU, veu | 
make current word uppercase, lowercase | 
| Moving around | |
} | 
move to next block | 
{ | 
move to previous block | 
w | 
move 1 word forward (beginning of next word) | 
e | 
move to end of word | 
0 | 
move to start of line | 
% | 
go to matching (,[, or { | 
G | 
move to bottom of file | 
gg | 
move to top of file | 
<#>G or <#>gg | 
move to <#> line | 
zz | 
center page on current line | 
ctrl-o | 
move to last position | 
ctrl-i | 
move forward positions | 
| Find and Replace | |
/ | 
search command | 
? | 
backward search command | 
n, N | 
find next, previous in search | 
/\c | 
search case insensitive | 
/^\n\{3} | 
find 3 emtpy lines | 
:s/<word1>/<word2>/g | 
replace all <word1> with <word2> in line | 
:%s/<word1>/<word2>/g | 
replace all <word1> with <word2> in whole file | 
| Set | |
:set ic | 
set 'ignore case' in searching | 
:set noic | 
unset 'ignore case' in searching | 
:set <option> | 
set <option> | 
| Other Commands | |
:!<cmd> | 
execute <cmd> in shell | 
:r <file> | 
inserts contents of <file> | 
:r !<cmd> | 
inserts output of <cmd> | 
:saveas <file> | 
save as | 
:q! | 
force quit no save | 
:wq | 
save and quit | 
Can use a digit before commands: x, d, y, u, w, e, >> to repeat action:
4dw: delete next 4 words2o: add 2 new lines5u: undo last 5 edits4>>: indent 4 lines once6yy: copy 6 lines