Cheat Sheet

Vim Cheat Sheet — Modes, Motions, Edits, Search/Replace

Practical Vim cheat sheet: modes, motions, edits, search/replace, buffers, splits, visual mode. Free, dense, with the commands you actually use.

A practical Vim cheat sheet — the commands you'll use after the first hour, organized by what you're trying to do. Tested on Vim 8 and Neovim.

The modes

ModeEnter from NormalWhat it's for
NormalEsc from anywhereDefault; navigate + run commands
Inserti a o O I AType text
Visualv (char) V (line) Ctrl-v (block)Select text
Command:Save, search, run external
ReplaceROverwrite as you type

Save & quit (Command mode)

CommandEffect
:wWrite (save)
:w newnameSave as new name
:qQuit (errors if unsaved changes)
:q!Quit, discard changes
:wq / :x / ZZSave + quit
:e fileOpen another file
:e!Reload current file from disk
:qa / :qa!Quit all buffers

Motions (navigate without arrow keys)

KeyMove
h j k lLeft, down, up, right
w / WNext word / WORD (W ignores punctuation)
b / BPrevious word / WORD
e / EEnd of word / WORD
0Start of line
^First non-whitespace on line
$End of line
ggTop of file
GBottom of file
123GGo to line 123
{ / }Previous / next paragraph
( / )Previous / next sentence
%Jump to matching bracket / paren / brace
Ctrl-d / Ctrl-uHalf page down / up
Ctrl-f / Ctrl-bFull page down / up
H M LTop / middle / bottom of screen
zzCenter current line on screen
``Jump back to previous position (two backticks)
Ctrl-o / Ctrl-iJump back / forward in jump list

Insert mode entry

KeyEffect
iInsert before cursor
aInsert after cursor
IInsert at start of line (first non-whitespace)
AInsert at end of line
oOpen new line below + insert
OOpen new line above + insert
sDelete char + insert
SDelete line + insert
ccChange line
cwChange word

Operators (combine with motions)

Pattern: operator + motion. Example: d (delete) + w (word) = dw (delete word).

OpMeansExample
dDelete (cut)d$ delete to end of line
cChange (delete + insert)ciw change inner word
yYank (copy)yy yank line
> / <Indent right / left>> indent line
=Auto-indentgg=G auto-indent whole file
~Toggle case~ toggle char
gU / guUpper / lower casegUw uppercase word

Text objects (use with operators)

ObjectMeans
iw / awInner word / a word (with surrounding space)
i" / a"Inside / around double quotes
i' / a'Inside / around single quotes
i( / i) / ibInside parens
i{ / i} / iBInside braces
i[ / i]Inside brackets
i< / itInside angle brackets / HTML tag
ip / apParagraph
is / asSentence

Combine: ci" = change inside double quotes. dap = delete a paragraph. yi( = yank inside parens.

Copy / paste / undo

KeyEffect
yy / YYank (copy) line
pPaste after cursor
PPaste before cursor
"+y / "+pYank/paste from system clipboard
uUndo
Ctrl-rRedo
.Repeat last change (the killer feature)

Search

KeyEffect
/patternSearch forward
?patternSearch backward
n / NNext / previous match
* / #Search word under cursor forward / backward
:nohClear highlight

Replace

:s/old/new/         Replace first on line
:s/old/new/g        Replace all on line
:%s/old/new/g       Replace all in file
:%s/old/new/gc      Replace all, confirm each
:%s/\<old\>/new/g    Replace whole word only
:5,20s/old/new/g    Replace in lines 5-20

Test patterns first with the regex tester — Vim's regex flavor is similar to PCRE with some quirks.

Visual mode

KeyEffect
vCharacter-wise selection
VLine-wise selection
Ctrl-vBlock-wise (column) selection
oMove cursor to other end of selection
gvRe-select last visual selection
(after selecting) d y c > < ~Apply operator to selection

Buffers, windows, tabs

CommandEffect
:lsList buffers
:b nameSwitch to buffer by name
:bn / :bpNext / prev buffer
:bdClose buffer
:split / :spHorizontal split
:vsplit / :vsVertical split
Ctrl-w h/j/k/lMove between splits
Ctrl-w =Equalize splits
Ctrl-w qClose split
:tabnewNew tab
gt / gTNext / prev tab

Macros (record + replay)

qa          Start recording macro into register a
... do stuff ...
q           Stop recording
@a          Play macro a
@@          Replay last macro
20@a        Run macro 20 times

Useful one-shots

CommandEffect
:e .Browse current directory
:r fileRead file content into current buffer
:r !dateInsert output of shell command
:!cmdRun shell command
:set number / :set nonuToggle line numbers
:set relativenumberRelative line numbers (great with motions)
:set ignorecase / :set smartcaseCase-insensitive search
:syntax onSyntax highlighting
:set listShow invisible characters (tabs, EOL)
:retabConvert tabs ↔ spaces per current settings

Related tools

Test substitution patterns before using :%s/.../.../: regex tester. Compare two files line-by-line: diff checker.

Featured Tools

Try these free tools directly in your browser — no sign-up required.

vim cheat sheet vim commands vim motions vim modes vim reference

Explore 300+ Free Tools

Utilko has tools for developers, writers, designers, students, and everyday users — all free, all browser-based.