Cheat sheet guide
Vim shortcuts worth learning first
This page collects 60 searchable Vim keyboard shortcuts across 6 categories. Start with the shortcuts for Modes, Navigation, Editing, Search & Replace, then print the cheat sheet once the important ones are worth keeping nearby.
- Switch OS tabs for Windows, macOS, or Linux shortcuts.
- Use / to jump to search instantly.
- Use Compare mode when moving between machines.
- Print or save the page as a compact PDF cheat sheet.
Modes
11 shortcuts
Enter Normal mode
Esc
WinEsc
MacEsc
LinuxEsc
Enter Insert mode
i
Wini
Maci
Linuxi
Insert at end of line
A
WinA
MacA
LinuxA
Insert on new line below
o
Wino
Maco
Linuxo
Insert on new line above
O
WinO
MacO
LinuxO
Enter Visual mode
v
Winv
Macv
Linuxv
Enter Visual Line mode
V
WinV
MacV
LinuxV
Enter Visual Block mode
Ctrl+V
WinCtrl+V
MacCtrl+V
LinuxCtrl+V
Enter Command-line mode
:
Win:
Mac:
Linux:
Replace single character
r
Winr
Macr
Linuxr
Replace mode (overwrite)
R
WinR
MacR
LinuxR
Navigation
12 shortcuts
Move left/down/up/right
h/j/k/l
Winh/j/k/l
Mach/j/k/l
Linuxh/j/k/l
Next / previous word
w/b
Winw/b
Macw/b
Linuxw/b
End of word
e
Wine
Mace
Linuxe
Start of line (non-blank)
^
Win^
Mac^
Linux^
End of line
$
Win$
Mac$
Linux$
First line of file
gg
Wingg
Macgg
Linuxgg
Last line of file
G
WinG
MacG
LinuxG
Go to line N
:NorNgg
Win:NorNgg
Mac:NorNgg
Linux:NorNgg
Half page down/up
Ctrl+D/Ctrl+U
WinCtrl+D/Ctrl+U
MacCtrl+D/Ctrl+U
LinuxCtrl+D/Ctrl+U
Jump to matching bracket
%
Win%
Mac%
Linux%
Jump to next/prev occurrence of char
f{char}/F{char}
Winf{char}/F{char}
Macf{char}/F{char}
Linuxf{char}/F{char}
Center view on cursor
zz
Winzz
Maczz
Linuxzz
Editing
15 shortcuts
Delete character
x
Winx
Macx
Linuxx
Delete line
dd
Windd
Macdd
Linuxdd
Delete word
dw
Windw
Macdw
Linuxdw
Delete to end of line
D
WinD
MacD
LinuxD
Yank (copy) line
yy
Winyy
Macyy
Linuxyy
Yank word
yw
Winyw
Macyw
Linuxyw
Paste after / before cursor
p/P
Winp/P
Macp/P
Linuxp/P
Change word
cw
Wincw
Maccw
Linuxcw
Change to end of line
C
WinC
MacC
LinuxC
Change entire line
cc
Wincc
Maccc
Linuxcc
Undo
u
Winu
Macu
Linuxu
Redo
Ctrl+R
WinCtrl+R
MacCtrl+R
LinuxCtrl+R
Repeat last change
.
Win.
Mac.
Linux.
Indent / unindent line
>>/<<
Win>>/<<
Mac>>/<<
Linux>>/<<
Auto-indent selection
=G(fromtop)
Win=G(fromtop)
Mac=G(fromtop)
Linux=G(fromtop)
Search & Replace
8 shortcuts
Search forward
/{pattern}
Win/{pattern}
Mac/{pattern}
Linux/{pattern}
Search backward
?{pattern}
Win?{pattern}
Mac?{pattern}
Linux?{pattern}
Next / previous match
n/N
Winn/N
Macn/N
Linuxn/N
Search word under cursor
*/#
Win*/#
Mac*/#
Linux*/#
Replace in line
:s/old/new/
Win:s/old/new/
Mac:s/old/new/
Linux:s/old/new/
Replace all in file
:%s/old/new/g
Win:%s/old/new/g
Mac:%s/old/new/g
Linux:%s/old/new/g
Replace with confirmation
:%s/old/new/gc
Win:%s/old/new/gc
Mac:%s/old/new/gc
Linux:%s/old/new/gc
Clear search highlight
:noh
Win:noh
Mac:noh
Linux:noh
File & Buffers
9 shortcuts
Save file
:w
Win:w
Mac:w
Linux:w
Save and quit
:wq
Win:wq
Mac:wq
Linux:wq
Quit without saving
:q!
Win:q!
Mac:q!
Linux:q!
Open file
:e{file}
Win:e{file}
Mac:e{file}
Linux:e{file}
List buffers
:ls
Win:ls
Mac:ls
Linux:ls
Next / previous buffer
:bn/:bp
Win:bn/:bp
Mac:bn/:bp
Linux:bn/:bp
Split horizontally
:sp
Win:sp
Mac:sp
Linux:sp
Split vertically
:vsp
Win:vsp
Mac:vsp
Linux:vsp
Navigate splits
Ctrl+Whjkl
WinCtrl+Whjkl
MacCtrl+Whjkl
LinuxCtrl+Whjkl
Macros
5 shortcuts
Record macro into register
q{letter}
Winq{letter}
Macq{letter}
Linuxq{letter}
Stop recording
q
Winq
Macq
Linuxq
Play macro
@{letter}
Win@{letter}
Mac@{letter}
Linux@{letter}
Repeat last macro
@@
Win@@
Mac@@
Linux@@
Run macro N times
N@{letter}
WinN@{letter}
MacN@{letter}
LinuxN@{letter}
Frequently asked questions
What is the fastest way to find Vim shortcuts on this page?
Use the search box or press /, then type an action such as enter normal mode.
Can I print this Vim shortcut cheat sheet?
Yes. Use the Print / PDF button or your browser print command to save a compact cheat sheet.
Does this page include Windows and Mac shortcuts for Vim?
Yes. Use the OS tabs to switch between Windows and macOS shortcuts. For example, Enter Normal mode is Esc on Windows and Esc on macOS where available.
Advertisement