vim.md

Vim #

A modal editor: keys do different things depending on the mode. Press Esc to return to Normal mode, where most commands live. Commands compose, so a count and a motion combine: 3dw deletes three words.

Modes #

KeyMode
EscBack to Normal mode
i aInsert before / after the cursor
I AInsert at line start / end
o OOpen a new line below / above
v VVisual (character / line) select
Ctrl-vVisual block select
:Command-line mode

Motions #

KeyMoves to
h j k lLeft, down, up, right
w b eNext word, back a word, end of word
0 ^ $Line start, first non-blank, line end
gg GFirst line, last line
{ }Previous / next paragraph
Ctrl-d Ctrl-uHalf page down / up
%Matching bracket
f x t xJump to / before next x on the line

Editing #

KeyAction
x rDelete char / replace one char
dd yy pDelete line, yank line, paste
dw cwDelete / change a word
d$ c$Delete / change to end of line
ciw ci"Change inner word / inside quotes
>> <<Indent / outdent the line
u Ctrl-rUndo / redo
.Repeat the last change
JJoin the next line up

Text objects & marks #

KeySelects
iw awInner word / word plus its space
i( a(Inside parentheses / parentheses included
i" a"Inside quotes / quotes included
it atInside an HTML tag / tag included
ip apInner paragraph / paragraph plus blank line
ci( dat yipChange in parens, delete a tag pair, yank a paragraph
ma          set mark a on the current line
'a          jump to the mark's line     `a   jump to its exact spot
:marks      list all marks
Ctrl-o  Ctrl-i      back / forward through the jump list

Registers & macros #

KeyAction
"ay "apYank into / paste from register a
"+y "+pCopy to / paste from the system clipboard
"0pPaste the last yank (deletes never touch register 0)
:registersView all registers
qa ... qRecord a macro into register a, stop with q
@a @@Replay macro a / repeat the last replay
5@aReplay macro a five times

Search & replace #

/pattern        search forward      ?pattern   search backward
n   N           next / previous match
*   #           search word under the cursor

:%s/old/new/g       replace all in the file
:%s/old/new/gc      ... with confirmation per match
:s/old/new/g        replace all on the current line
:noh                clear search highlight

:g/pattern/d        delete every line that matches
:g!/pattern/d       delete every line that does not match (:v/pattern/d is the same)

Buffers, windows, tabs #

:e file         open a file        :w   write     :q   quit    :wq  write+quit
:bn  :bp        next / prev buffer        :ls       list buffers
:sp  :vsp       split horizontal / vertical
Ctrl-w h/j/k/l  move between splits        Ctrl-w q  close split
:tabnew         new tab           gt  gT   next / prev tab

Survival #

KeyAction
:q!Quit without saving
ZZSave and quit
:w !sudo tee %Save a file you opened without sudo
q:Open the command history window
:help xHelp for command x
gg=GRe-indent the whole file
Ctrl-o Ctrl-iJump to older / newer cursor position

© 2026 Anguished LLC · anguishedturtle.com · About · Bit Night Runner · Support · Privacy