Vim Cheatsheet

A fast, practical reference. Commands are case-sensitive. <Leader> defaults to \ (or , if you set it so).


Start & Quit

vim file          " open file
:n                " go to line n
:w                " write (save)
:w filename       " save as
:q                " quit
:q!               " quit without saving
:wq / :x          " write and quit
:wa               " write all buffers
:qa               " quit all

Modes & Inserts

i        " insert before cursor
I        " insert at line start
a        " append after cursor
A        " append at line end
o / O    " open new line below/above
s / S    " substitute char / whole line
cc / C   " change line / to EOL
R        " replace (overwrite) mode
Esc      " back to Normal mode

Movement (Normal Mode)

Find Characters (on line)

Select (Visual)

Edit: Delete / Change / Yank (Copy) / Put (Paste)

Counts & Repeats

Indent & Format

Search & Replace

Buffers, Tabs & Windows

Marks & Jumps

Registers & System Clipboard

Macros

Files, Explore, and Info

Folding (built-in)

Useful Settings (put in vimrc)

Command-Line Fu

Quick Reference Table

Task

Normal Mode Command

Save / Quit

:w / :q / :wq / :q!

Move by word

w / b / e

Line start / end

^ / $

Insert / Append

i / a

New line

o / O

Delete word / to EOL

dw / D

Yank line / Paste

yy / p

Undo / Redo

u / Ctrl-r

Search next

n

Visual modes

v / V / Ctrl-v

Split / Vsplit

:sp / :vsp

Next buffer / tab

:bn / :tabn


Tip: Nearly every action is operator + {motion}. Learn a few motions (w, $, fX, }) and operators (d, c, y, gU, gu) to compose powerful edits quickly.

Last updated

Was this helpful?