Skip to content

Vim Keyboard Shortcuts Cheatsheet — Printable PDF Reference

DodaTech Updated 2026-06-20 7 min read

In this tutorial, you'll learn about Vim Keyboard Shortcuts Cheatsheet. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.

📄 Printable PDF: Use your browser's Print (Ctrl+P / Cmd+P) → "Save as PDF" to get a printer-friendly PDF of this Vim shortcut cheatsheet.

Complete Vim keyboard shortcuts reference for efficient text editing without touching the mouse. Covers normal mode, insert mode, visual mode, buffers, Windows, marks, registers, and ex commands.

Basic Navigation (Normal Mode)

Shortcut What it does
h / j / k / l Left / Down / Up / Right
w / b Next word / Back word
W / B Next WORD / Back WORD
e / ge End of word / End of prev word
0 / $ Start of line / End of line
^ First non-blank character
gg / G First line / Last line
:42 or 42G Go to line 42
Ctrl+d / Ctrl+u Page down / Page up (half)
Ctrl+f / Ctrl+b Page down / Page up (full)
H / M / L Top / Middle / Bottom of screen
% Matching bracket
{ / } Previous / Next paragraph
( / ) Previous / Next sentence
zz Center screen on cursor
zt / zb Cursor to top / bottom of screen

Insert Mode

Shortcut What it does
i Insert before cursor
I Insert at start of line
a Append after cursor
A Append at end of line
o Open new line below
O Open new line above
s Delete char and insert
S Delete line and insert
gi Resume last insert position
Esc / Ctrl+[ Return to normal mode
Ctrl+h Delete char before cursor (backspace)
Ctrl+w Delete word before cursor
Ctrl+u Delete to start of line
Ctrl+r {reg} Insert from register

Visual Mode

Shortcut What it does
v Start character-wise visual
V Start line-wise visual
Ctrl+v Start block-wise visual
gv Reselect previous visual
o Move to other end of selection
aw / iw Select a word / inner word
a( / i( Select around / inside parens
a{ / i{ Select around / inside braces
a[ / i[ Select around / inside brackets
a" / i" Select around / inside quotes
> / < Indent / outdent selection
~ / u / U Toggle / lowercase / uppercase
d / y Delete / yank (copy) selection

Editing & Yank/Paste

Shortcut What it does
x Delete character under cursor
X Delete character before cursor
dd Delete line
dw / daw Delete word / a word
d$ / d0 Delete to end / start of line
diw / daw Delete inner word / a word
yy Yank (copy) line
Y Yank to end of line
yw / y$ Yank word / to end of line
p / P Paste after / before cursor
gp / gP Paste and move cursor after
u / Ctrl+r Undo / Redo
. Repeat last change
J Join lines
r{x} Replace char under cursor
R Enter replace mode
cc Change (replace) whole line
C Change to end of line
c$ Change to end of line
ciw / ci( Change inner word / inside parens

Search & Replace

Shortcut What it does
/pattern Search forward
?pattern Search backward
n / N Next match / Previous match
* / # Search word under cursor forward / backward
:%s/old/new/g Replace all in file
:%s/old/new/gc Replace all with confirm
:5,10s/old/new/g Replace in lines 5–10
:noh Clear search highlight

Windows & Tabs

| Shortcut | What it does | |----------|-------------| | :sp [file] | Split window horizontally | | :vs [file] | Split window vertically | | Ctrl+w s | Horizontal split | | Ctrl+w v | Vertical split | | Ctrl+w w | Cycle Windows | | Ctrl+w h/j/k/l | Navigate Windows | | Ctrl+w H/J/K/L | Move window to far left/down/up/right | | Ctrl+w = | Equal size Windows | | Ctrl+w _ / Ctrl+w | | Maximize height / width | | :q or Ctrl+w q | Close window | | :tabnew | New tab | | gt / gT | Next tab / Previous tab | | {n}gt | Go to tab n | | :tabclose | Close tab |

Buffers

Shortcut What it does
:e file Edit file (open in buffer)
:bnext or :bn Next buffer
:bprev or :bp Previous buffer
:bfirst / :blast First / last buffer
:bd Delete (close) buffer
:ls List all buffers
:b {n} Go to buffer n
Ctrl+^ Toggle to alternate buffer
:bdelete Delete buffer
:bufdo Command on all buffers

Marks & Registers

Shortcut What it does
m{a-z} Set local mark
m{A-Z} Set global mark (across files)
'{a-z} Jump to line of mark
`{a-z} Jump to exact position of mark
:marks List all marks
"{reg}y Yank into specific register
"{reg}p Paste from specific register
"0 / "1 Yank register / delete register
"+y Yank to system clipboard
"+p Paste from system clipboard
:reg List all registers
qq / q Start / stop recording macro to q
@q Play macro from register q

Ex Commands

Command What it does
:w Save file
:q Quit
:wq or :x Save and quit
:q! Force quit (discard changes)
:w! Force write (overwrite read-only)
:e! Reload file (discard changes)
:set number Show line numbers
:set nonumber Hide line numbers
:set relativenumber Relative line numbers
:set hlsearch Highlight search matches
:set incsearch Incremental search
:set ignorecase Case-insensitive search
:set smartcase Smart case search
:set tabstop=4 Tab width = 4
:set shiftwidth=4 Indent width = 4
:set expandtab Tabs → spaces
:colorscheme {name} Change color scheme
:help {topic} Open help for topic
:!{cmd} Run shell command
How do I exit Vim?

Press Esc to ensure you're in normal mode, then type :q and press Enter. To save and exit, type :wq or :x. To force quit without saving, type :q!. If you see E37: No write since last change, use :q! to discard changes or :wq to save them.

How do I search and replace in Vim?

Use the substitute command: :%s/old/new/g replaces all occurrences of "old" with "new" in the file. Add c at the end (:%s/old/new/gc) for confirmation on each match. For a line range, use :5,10s/old/new/g to replace only between lines 5 and 10.

See the full Vim guide for advanced configuration and custom key mappings.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro