vim cheat sheet



0         ^                                       %          $
          word worditty wordyword( wordly( word ) ) // wordric
               b←    →e     *→         fl (repeat: ;→ ,←)   
G

%s/orig\c/replace/gc
↑      ↑↑          ↑
file   case insen. confirm


search delimiters

^  \<         \>  $
 ... wordyword ...

Buffers
KeyCommand
:lslist buffers
Ctrl+6go to alt buffer
:bpGo back
:bnGo forward
:bd #Delete buffer
:e nameEdit file
gf
^w,f
Goto file
(F) at pos

KeyCommand
Ctrl+w nNew buffer
Ctrl+w,vVert split
Ctrl+w,sHoriz split
Ctrl+w,qClose
Ctrl+w,oClose others
Ctrl+w,KMove up
Ctrl+w,+ >Reize
:new | r! grep -nrI pat

Folding / Diff
KeyCommand
zM zRFold/Unfold all
zaFold/Unfold
zo zcOpen/Close fold
]cNext change
[cPrev change
doDiff get
dpDiff put
$ P4DIFF=vimdiff p4 …
:windo set wrap

Mark (' or `)
KeyCommand
m[a-z`]Set mark at pos
`[a-z`]Jump to mark
Ctrl+oGo back
Ctrl+iGo forward

Visual Mode
KeyCommand
v or VEnter visual mode
EscExit visual mode
< or >Shift text
y/^r"find selection
yq/pfind selection
^VI#[esc]

CTags
KeyCommand
g,Ctrl+]Goto or list
Ctrl+]Go to tag
g]List tags
Ctrl+tJump back

Line Change
KeyCommand
CChange to eol
ccChange the line
DDelete to eol
A or IAppend/Insert

Undo
KeyCommand
u or UUndo (Line)
Ctrl+rRedo

KeyCommand
:tabnew fnnew tab
:tabcclose tab
:tabnnext
:tabpprev

Autocomplete
KeyCommand
^x,^oOpen list
^pup
^ndown

Misc
KeyCommand
:!shell
:!%execute filename
:r!%read into buffer
>aBIndent a Block

KeyCommand
yiwyank inner word
viwpselect, replace
viw"0pthird time
Vpreplace line

© 2011, 2012 David Blume