Searchable reference of common Vim commands for modes, movement, editing, search and windows.
59 of 59 commands — click any row to copy
i
Enter Insert mode before the cursor
a
Enter Insert mode after the cursor
Esc
Return to Normal mode from any other mode
v
Enter Visual mode (character-wise selection)
V
Enter Visual Line mode (line-wise selection)
Ctrl-v
Enter Visual Block mode (column selection)
:
Enter Command-line mode
R
Enter Replace mode (overtype characters)
h j k l
Move left, down, up, right one character
w
Move to the start of the next word
b
Move to the start of the previous word
e
Move to the end of the current word
0
Move to the start of the line
^
Move to the first non-blank character of the line
$
Move to the end of the line
gg
Move to the first line of the file
G
Move to the last line of the file
:<line>
Jump to a specific line number, e.g. :42
Ctrl-f
Scroll forward (down) one full screen
Ctrl-b
Scroll backward (up) one full screen
%
Jump to the matching bracket/parenthesis/brace
{ }
Move to the previous/next blank-line-separated paragraph
x
Delete the character under the cursor
dd
Delete (cut) the current line
dw
Delete (cut) to the end of the current word
D
Delete from the cursor to the end of the line
yy
Yank (copy) the current line
p
Paste after the cursor / below the current line
P
Paste before the cursor / above the current line
u
Undo the last change
Ctrl-r
Redo the last undone change
cc
Change (delete and insert) the current line
cw
Change (delete and insert) to the end of the current word
r<char>
Replace the character under the cursor with <char>
~
Toggle the case of the character under the cursor
J
Join the current line with the next line
.
Repeat the last change
/pattern
Search forward for pattern
?pattern
Search backward for pattern
n
Repeat the last search in the same direction
N
Repeat the last search in the opposite direction
*
Search forward for the word under the cursor
:%s/old/new/g
Replace all occurrences of 'old' with 'new' in the file
:%s/old/new/gc
Replace all occurrences with confirmation prompt for each
:noh
Clear search highlighting
:w
Save (write) the current file
:q
Quit (close the current window/buffer)
:wq
Save and quit
:q!
Quit without saving, discarding changes
:e <file>
Open (edit) a file
:sp <file>
Split the window horizontally and open a file
:vsp <file>
Split the window vertically and open a file
Ctrl-w w
Move focus to the next window/split
:bn / :bp
Switch to the next / previous buffer
v then y
Select characters in Visual mode, then yank (copy) the selection
V then d
Select whole lines in Visual Line mode, then delete them
gv
Re-select the last visual selection
> / <
Indent or unindent the selected lines
u (in visual mode)
Lowercase the selected text