Vim cheat sheet

Last updated 8 October 2026

The Vim commands a beginner needs, grouped in the order you learn them. Each group names the Vimrealm chapter that teaches it, so you can practise any command in the game instead of just reading about it.

All of these are typed in Normal mode, the mode Vim starts in, unless the table says otherwise. Press Esc to get back to Normal mode from anywhere. A {c} means "any character" and {n} means "a number".

How to save and quit Vim

Type these in Normal mode. Each one starts a command line at the bottom of the screen and runs when you press Enter.

KeysWhat it does
:wsave the file
:qquit (Vim refuses if there are unsaved changes)
:wqsave and quit
:q!quit and throw away unsaved changes
ZZ ZQthe Normal mode shortcuts for :x (save if changed, then quit) and :q!
:e!reload the file and throw away unsaved changes

Basic movement: h j k l

Your fingers stay on the home row. Put a number in front of almost any command to repeat it.

KeysWhat it does
h lmove left / right one character
j kmove down / up one line. The cursor remembers its column when it passes shorter lines.
{n}prefix a number to repeat: 5j, 3w, 2dd
Practise in chapter 1, Meadow of Motion (free).

Moving by word

A word is a run of letters, digits and underscores, or a run of punctuation. A WORD is anything separated by spaces, so foo.bar(x) is several words but one WORD.

KeysWhat it does
wjump to the start of the next word
bjump back to the start of a word
ejump to the end of the word
gejump back to the end of the previous word
W B E gEthe same four moves by WORD
Practise in chapter 2, Forest of Words (free).

Start and end of a line

KeysWhat it does
0jump to column zero
^jump to the first non-blank character
$jump to the end of the line
g_jump to the last non-blank character, skipping trailing spaces
Practise in chapter 3, Cliffs of Line's End (free).

Find a character in the line: f, t, ; and ,

KeysWhat it does
f{c}jump onto the next {c} in the line
F{c}jump onto the previous {c} in the line
t{c}jump till just before the next {c}
T{c}jump till just after the previous {c}
;repeat the last f, t, F or T
,repeat it in the opposite direction
Practise in chapter 4, Seeker's Cave (free).

Moving through the whole file

KeysWhat it does
gggo to the first line
Ggo to the last line
{n}G or :{n} Entergo to line {n}
} {jump to the next / previous blank line (paragraph)
%jump to the matching bracket
Practise in chapter 5, Mountain of Lines (free).

Small edits, undo and redo

KeysWhat it does
xdelete the character under the cursor
Xdelete the character before the cursor
r{c}replace the character under the cursor with {c}
dddelete the whole line
~toggle the case of the character under the cursor: 5~ toggles five
Jjoin the line below onto this one, with one space between
gJjoin the line below as it is, adding and removing no spaces
uundo the last change
Ctrl-rredo an undone change
Practise in chapter 6, The Breaking Arts (full version).

Insert mode

Each of these switches to Insert mode, where keys type text. Press Esc to return to Normal mode.

KeysStarts typing…
ibefore the cursor
aafter the cursor
Iat the first non-blank character of the line
Aat the end of the line
oon a new line below
Oon a new line above
Rin Replace mode: each character types over the one under the cursor, and Backspace brings the old one back
Practise in chapter 7, Scribe's Tower (full version).

Operators: verb + motion

This is where Vim gets its power. An operator is a verb, and any motion from above says how far it reaches: dw deletes to the next word, d$ to the end of the line, dt) up to the next ). Typing the operator twice works on the whole line.

KeysWhat it does
d{motion}delete over a motion: dw, d$, dt)
c{motion}delete over a motion, then start Insert mode: cw, c$
Ddelete to the end of the line (same as d$)
Cchange to the end of the line (same as c$)
cc or Schange the whole line
sdelete the character and start Insert mode (same as cl)
gu{motion} gU{motion}lowercase / UPPERCASE over a motion: gUiw, gu$. guu and gUU work on the line
g~{motion}toggle case over a motion; g~~ toggles the line
Practise in chapter 8, Operator Sanctum (full version).

Text objects

After an operator, a text object picks a whole thing around the cursor, wherever the cursor is inside it. i means "inner" (just the contents) and a means "a" (the contents plus the quotes, brackets or surrounding space). So ciw changes the word under the cursor and di( empties a pair of parentheses.

KeysSelects
iw awthe word under the cursor / plus surrounding space
iW aWthe WORD under the cursor / plus surrounding space
i" a"inside "double quotes" / quotes included
i' a'inside 'single quotes' / quotes included
i( a( (also ib ab)inside ( ) / parentheses included
i{ a{ (also iB aB)inside { } / braces included
i[ a[inside [ ] / brackets included
Practise in chapter 9, Temple of Objects (full version). More examples: Vim text objects explained.

Copy and paste (yank and put), and the dot command

KeysWhat it does
y{motion}copy over a motion: yw, y$, yi(
yy or Ycopy the whole line (in Neovim, Y copies to the end of the line)
ppaste after the cursor, or below the line for whole lines
Ppaste before the cursor, or above the line
gp gPpaste like p / P, then leave the cursor just after the pasted text
.repeat the last change
Practise in chapter 10, Hall of Echoes (full version). More examples: the Vim dot command.

Deleting with d, x or c also stores the text, so ddp swaps a line with the one below it.

KeysWhat it does
/{text} Entersearch forward for text
?{text} Entersearch backward for text
nrepeat the search in the same direction
Nrepeat the search in the opposite direction
*search forward for the word under the cursor
#search backward for the word under the cursor
Practise in chapter 11, Oracle's Archive (full version).

Visual mode

Select first, then act: move to grow the selection, then press an operator such as d, c or y.

KeysWhat it does
vVisual mode: select characters
VVisual Line mode: select whole lines
U(in Visual mode) uppercase the selection
Esccancel the selection
Practise in chapter 12, Chamber of Light (full version).

Reading a cheat sheet won't put these in your fingers. Typing them will.

Practise in Vimrealm, free