Basic Movement
h
Move cursor left
j
Move cursor down
k
Move cursor up
l
Move cursor right
w
Move to next word
b
Move to previous word
0
Move to beginning of line
$
Move to end of line
Editing
i
Insert before cursor
a
Insert after cursor
o
Open new line below
O
Open new line above
x
Delete character
dd
Delete line
yy
Copy line
p
Paste after cursor
Search & Replace
/text
Search forward for "text"
?text
Search backward for "text"
n
Next search result
N
Previous search result
:%s/old/new/g
Replace all "old" with "new"
File Operations
:w
Save file
:q
Quit VIM
:wq
Save and quit
:q!
Quit without saving
:e file
Open file
Visual Mode
v
Start visual mode
V
Start line visual mode
Ctrl+v
Start block visual mode
d
Visual Delete selection
y
Visual Copy selection
Navigation
gg
Go to first line
G
Go to last line
:n
Go to line n
Ctrl+f
Page down
Ctrl+b
Page up
VIM Modes
Normal Default mode for navigation and commands
Insert Mode for typing text (Enter with 'i', 'a', 'o', etc.)
Visual Mode for selecting text (Enter with 'v', 'V', Ctrl+v)
Command Mode for executing commands (Enter with ':')
Press ESC to return to Normal mode from any other mode