Vim Commands
Mode Switching
i—Insert before cursor
I—Insert at line start
a—Append after cursor
A—Append at line end
o / O—New line below / above
v / V—Visual / line select
Ctrl+v—Visual block mode
Esc—Return to normal mode
R—Replace mode
:—Command mode
Movement
h j k l—Left, down, up, right
w / b—Next / prev word
e—End of word
0 / $—Start / end of line
^—First non-blank char
gg / G—Top / bottom of file
:n—Go to line n
Ctrl+d / Ctrl+u—Half page down / up
Ctrl+f / Ctrl+b—Full page down / up
{ / }—Prev / next paragraph
%—Matching bracket
H / M / L—Top / mid / bottom screen
Editing
x—Delete char at cursor
dd—Delete (cut) line
dw—Delete word
D—Delete to end of line
cc—Change (replace) line
cw—Change word
C—Change to end of line
r<char>—Replace single char
J—Join line below
~—Toggle case
.—Repeat last command
u / Ctrl+r—Undo / redo
Copy & Paste
yy—Yank (copy) line
yw—Yank word
y$—Yank to end of line
p / P—Paste after / before
dd—Cut line
"ay—Yank into register a
"ap—Paste from register a
:reg—View all registers
Search & Replace
/pattern—Search forward
?pattern—Search backward
n / N—Next / prev match
*—Search word under cursor
:%s/old/new/g—Replace all in file
:s/old/new/g—Replace in current line
:%s/old/new/gc—Replace with confirm
:noh—Clear search highlight
Files & Buffers
:w—Save file
:q—Quit
:wq / :x / ZZ—Save and quit
:q!—Quit without saving
:e file—Open file
:bn / :bp—Next / prev buffer
:ls—List buffers
:sp / :vsp—Horizontal / vertical split
Window & Tabs
Ctrl+w s—Horizontal split
Ctrl+w v—Vertical split
Ctrl+w h/j/k/l—Navigate splits
Ctrl+w =—Equal split sizes
:tabnew—New tab
gt / gT—Next / prev tab
Macros & Marks
qa—Record macro to reg a
q—Stop recording
@a—Play macro a
@@—Repeat last macro
ma—Set mark a
'a—Jump to mark a
''—Jump to last position
:marks—List all marks
Text Objects
diw—Delete inner word
ciw—Change inner word
di"—Delete inside quotes
ci(—Change inside parens
da{—Delete around braces
dit—Delete inside tag
yiw—Yank inner word
vip—Select paragraph
allprintabledoc.com