I MODES - The Core of Vim
1. Normal Mode (Command Mode)
Navigation:
h, j, k, l
left, down, up, right
w, b
word forward, word backward
e, ge
end of word, end of previous word
0, ^, $
start of line, first non-blank, end of line
gg, G
top of file, bottom of file
%
match parenthesis/bracket
Editing:
x, X
delete char forward, backward
dd, dw, de
delete line, word, end of word
cc, cw, ce
change line, word, end of word
r
replace single character
~
change case of character
J
join lines
Copy/Paste:
yy, yw, ye
yank line, word, end of word
p, P
put/paste after/before cursor
"ayy, "ap
yank/paste with register 'a'
Undo/Redo:
u
undo last change
Ctrl+r
redo last undo
.
repeat last command
2. Insert Mode
Entering Insert Mode:
i
insert at cursor
a
append after cursor
I
insert at beginning of line
A
append at end of line
o
open new line below
O
open new line above
Exiting Insert Mode:
Esc
return to Normal Mode
Ctrl+c
alternative to Esc
3. Visual Mode
Entering Visual Mode:
v
character-wise selection
V
line-wise selection
Ctrl+v
block-wise selection
Actions on Selection:
d
delete selected text
y
yank/copy selected text
~
change case of selected text
I / A
insert before/after selection (block mode)
>
indent selection
<
unindent selection
4. Command-Line Mode
File Operations:
:w
save file
:q
quit
:wq
save and quit
:q!
quit without saving
:e filename
edit new file
:split / :vsplit
split window
Search & Replace:
/pattern
search forward
?pattern
search backward
n, N
next, previous match
:s/old/new/
substitute on current line
:%s/old/new/g
substitute throughout file
:set ic
ignore case in searches