vi/vim cheat sheet

normal mode (default)

Esc normal mode
Esc normal mode
Esc normal mode
Esc normal mode
Esc normal mode
Esc normal mode
Esc normal mode
Esc normal mode
Esc insert mode
Esc normal mode
Esc normal mode
Esc visual mode
Esc visual mode
Esc normal mode
normal mode: numeric row ctrl ^@ ^^ edit alt. file ^_
normal mode: numeric row shift ~ case toggle ! filter lines play macro # rev. find word $ eol % goto match ^ "soft" bol & :s repeat * find word ( begin sentence ) end sentence _ "soft" bol down + next line
normal mode: numeric row goto mark 1 2 3 4 5 6 7 8 9 0 "hard" bol - prev line = reindent
quit commands: numeric row ctrl Z^@ Z^^ Z^_
quit commands: numeric row shift Z~ Z! Z@ Z# Z$ Z% Z^ Z& Z* Z( Z) Z_ Z+
quit commands: numeric row Z` Z1 Z2 Z3 Z4 Z5 Z6 Z7 Z8 Z9 Z0 Z- Z=
backward search commands ([): numeric row ctrl [^@ [^^ [^_
backward search commands ([): numeric row shift [~ [! [@ [# previous open #if/#else [$ [% [^ [& [* »[/ [( previous open ( [) [_ [+
backward search commands ([): numeric row [` previous lc mark [1 [2 [3 [4 [5 [6 [7 [8 [9 [0 [- [=
forward search commands (]): numeric row ctrl ]^@ ]^^ ]^_
forward search commands (]): numeric row shift ]~ ]! ]@ ]# next open #endif/#else ]$ ]% ]^ ]& ]* »]/ ]( ]) next open ) ]_ ]+
forward search commands (]): numeric row ]` next lc mark ]1 ]2 ]3 ]4 ]5 ]6 ]7 ]8 ]9 ]0 ]- ]=
window commands (ctrl-w): numeric row ctrl ŵ^@ ŵ^^ ŵ^_
window commands (ctrl-w): numeric row shift ŵ~ ŵ! ŵ@ ŵ# ŵ$ ŵ% ŵ^ split, edit alt file ŵ& ŵ* ŵ( ŵ) ŵ_ set height ŵ+ height increase
window commands (ctrl-w): numeric row ŵ` ŵ1 ŵ2 ŵ3 ŵ4 ŵ5 ŵ6 ŵ7 ŵ8 ŵ9 ŵ0 ŵ- height decrease ŵ= same height
extended window commands (ctrl-w g): numeric row ctrl ŵg^@ ŵg^^ ŵg^_
extended window commands (ctrl-w g): numeric row shift ŵg~ ŵg! ŵg@ ŵg# ŵg$ ŵg% ŵg^ ŵg& ŵg* ŵg( ŵg) ŵg_ ŵg+
extended window commands (ctrl-w g): numeric row ŵg` ŵg1 ŵg2 ŵg3 ŵg4 ŵg5 ŵg6 ŵg7 ŵg8 ŵg9 ŵg0 ŵg- ŵg=
extended commands (g): numeric row ctrl g^@ g^^ g^_
extended commands (g): numeric row shift g~ case toggle g! g@ operatorfunc g# rev. find string g$ virtual eol g% g^ "soft" bol virtual g& :s repeat globally g* find string g( g) g_ "soft" eol g+ later undo
extended commands (g): numeric row g`· to mark keepjumps g1 g2 g3 g4 g5 g6 g7 g8 char hex values g9 g0 virtual bol g- earlier undo g=
insert mode: numeric row ctrl ^@ last insert ^^ toggle :lmap usage ^_ toggle language
insert mode: numeric row shift ~ ! @ # $ % ^ & * ( ) _ +
insert mode: numeric row ` 1 2 3 4 5 6 7 8 9 0 - =
extended insert commands (i ctrl-g): numeric row ctrl ĝ^@ ĝ^^ ĝ^_
extended insert commands (i ctrl-g): numeric row shift ĝ~ ĝ! ĝ@ ĝ# ĝ$ ĝ% ĝ^ ĝ& ĝ* ĝ( ĝ) ĝ_ ĝ+
extended insert commands (i ctrl-g): numeric row ĝ` ĝ1 ĝ2 ĝ3 ĝ4 ĝ5 ĝ6 ĝ7 ĝ8 ĝ9 ĝ0 ĝ- ĝ=
insert completion commands (i ctrl-x): numeric row ctrl ^@ ^^ ^_
insert completion commands (i ctrl-x): numeric row shift x̂~ x̂! x̂@ x̂# x̂$ x̂% x̂^ x̂& x̂* x̂( x̂) x̂_ x̂+
insert completion commands (i ctrl-x): numeric row x̂` x̂1 x̂2 x̂3 x̂4 x̂5 x̂6 x̂7 x̂8 x̂9 x̂0 x̂- x̂=
visual mode: numeric row ctrl ^@ ^^ ^_
visual mode: numeric row shift ~ toggle case ! external filter @ # »# $ »$ % »% ^ »^ & * »* ( »( ) ») _ »_ + »+
visual mode: numeric row »` 1 2 3 4 5 6 7 8 9 0 »0 - »- = reindent
text object selection (v a/i): numeric row ctrl ^@ ^^ ^_
text object selection (v a/i): numeric row shift ~ ! @ # $ % ^ & * ( »vab ) »vab _ +
text object selection (v a/i): numeric row ` »va' 1 2 3 4 5 6 7 8 9 0 - =
extended visual commands (v g): numeric row ctrl g^@ g^^ g^_
extended visual commands (v g): numeric row shift g~ g! g@ g# g$ g% g^ g& g* g( g) g_ g+
extended visual commands (v g): numeric row g` g1 g2 g3 g4 g5 g6 g7 g8 g9 g0 g- g=
additional commands (z): numeric row ctrl z^@ z^^ z^_
additional commands (z): numeric row shift z~ z! z@ z# z$ z% z^ page above z& z* z( z) z_ z+ page below
additional commands (z): numeric row z` z1 z2 z3 z4 z5 z6 z7 z8 z9 z0 z- line at bottom bol z= suggest spelling
normal mode: top row ctrl ^q (xon) ^ window cmds ^e window down ^r redo ^t back tag ^y window up ^u scroll up ^i jump to newer ^o jump to older ^p »k ^[ ^] go to tag
normal mode: top row shift Q ex mode W next word E end word R replace mode T back till char Y yank line U undo line I insert at bol O line above P paste before { begin parag. } end parag.
normal mode: top row record macro w next word e end word replace char till char y yank u undo i insert mode o line below p paste after move backwards move forward
quit commands: top row ctrl Z^q Z^w Z^e Z^r Z^t Z^y Z^u Z^i Z^o Z^p Z^[ »esc Z^]
quit commands: top row shift ZQ :q! (force) ZW ZE ZR ZT ZY ZU ZI ZO ZP Z{ Z}
quit commands: top row Zq Zw Ze Zr Zt Zy Zu Zi Zo Zp Z[ Z]
backward search commands ([): top row ctrl [^q [^w [^e [^r [^t [^y [^u [^i to first occurrence [^o [^p [^[ »esc [^]
backward search commands ([): top row shift [Q [W [E [R [T [Y [U [I first occurrence [O [P [p [{ previous open { [}
backward search commands ([): top row [q [w [e [r [t [y [u [i first occurrence line [o [p P reindented [[ section backwards [] section backwards
forward search commands (]): top row ctrl ]^q ]^w ]^e ]^r ]^t ]^y ]^u ]^i to occurrence ]^o ]^p ]^[ »esc ]^]
forward search commands (]): top row shift ]Q ]W ]E ]R ]T ]Y ]U ]I next occurrence ]O ]P »[p ]{ ]} next open }
forward search commands (]): top row ]q ]w ]e ]r ]t ]y ]u ]i next occurrence line ]o ]p p reindented ][ section forward ]] section forward
window commands (ctrl-w): top row ctrl ŵ^q ŵ^w ŵ^e ŵ^r ŵ^t ŵ^y ŵ^u ŵ^i ŵ^o ŵ^p ŵ^[ »esc ŵ^]
window commands (ctrl-w): top row shift ŵQ ŵW go above/left ŵE ŵR rotate upwards ŵT ŵY ŵU ŵI ŵO ŵP go to preview ŵ{ ŵ} preview tag
window commands (ctrl-w): top row ŵq :quit current ŵw go to next ŵe ŵr rotate downwards ŵt go to top ŵy ŵu ŵi split, to decl of identifier ŵo :only current ŵp go to previous ŵ[ ŵ] split, to tag
extended window commands (ctrl-w g): top row ctrl ŵg^q ŵg^w ŵg^e ŵg^r ŵg^t ŵg^y ŵg^u ŵg^i ŵg^o ŵg^p ŵg^[ »esc ŵg^] split, :tjump
extended window commands (ctrl-w g): top row shift ŵgQ ŵgW ŵgE ŵgR ŵgT ŵgY ŵgU ŵgI ŵgO ŵgP ŵg{ ŵg} :ptjump to tag
extended window commands (ctrl-w g): top row ŵgq ŵgw ŵge ŵgr ŵgt ŵgy ŵgu ŵgi ŵgo ŵgp ŵg[ ŵg] split, :tselect
extended commands (g): top row ctrl g^q g^w g^e g^r g^t g^y g^u g^i g^o g^p g^[ g^] go to tjump
extended commands (g): top row shift gQ ex mode manual : gW gE back to word end gR virt. replace mode gT tab back gY gU uppercase gI insert at soft bol gO gP paste before still g{ g}
extended commands (g): top row gq format gw format still ge back to word end gr· virt. replace char gt next tab gy gu lowercase gi insert at last pos go :goto (byte) gp paste still g[ g] go to tselect
insert mode: top row ctrl ^q »^q ^w delete word back ^e ins char below ^ insert register ^t indent ^y ins char above ^u delete line ^i tab ^o execute cmd ^p find prev keyword ^[ »esc ^] abbreviate
insert mode: top row shift Q W E R T Y U I O P { }
insert mode: top row q w e r t y u i o p [ ]
extended insert commands (i ctrl-g): top row ctrl ĝ^q ĝ^w ĝ^e ĝ^r ĝ^t ĝ^y ĝ^u ĝ^i ĝ^o ĝ^p ĝ^[ ĝ^]
extended insert commands (i ctrl-g): top row shift ĝQ ĝW ĝE ĝR ĝT ĝY ĝU ĝI ĝO ĝP ĝ{ ĝ}
extended insert commands (i ctrl-g): top row ĝq ĝw ĝe ĝr ĝt ĝy ĝu break undo sequence ĝi ĝo ĝp ĝ[ ĝ]
insert completion commands (i ctrl-x): top row ctrl ^q ^w ^e window up ^r ^t thesaurus complete ^y window down ^u custom complete ^i ident complete ^o omni complete ^p prev complete ^[ »esc ^] tag complete
insert completion commands (i ctrl-x): top row shift x̂Q x̂W x̂E x̂R x̂T x̂Y x̂U x̂I x̂O x̂P x̂{ x̂}
insert completion commands (i ctrl-x): top row x̂q x̂w x̂e x̂r x̂t x̂y x̂u x̂i x̂o x̂p x̂[ x̂]
visual mode: top row ctrl ^q »^q ^ »^w ^e »^e ^r ^t ^y »^y ^u »^u ^i »^i ^o visual once ^p »^p ^[ »esc ^] jump to tag
visual mode: top row shift Q W »W E »E R »vS T »T Y yank lines U uppercase I insert to block O to other side P replace w/ paste { »{ } »}
visual mode: top row »q w »w e »e fill up w/ char »t y yank area u lowercase extend inner area o to other corner p replace w/ paste »[ »]
text object selection (v a/i): top row ctrl ^q ^w ^e ^r ^t ^y ^u ^i ^o ^p ^[ »esc ^]
text object selection (v a/i): top row shift Q W word E R T Y U I O P { »vaB } »vaB
text object selection (v a/i): top row q w word e r t xml tag block y u i o p paragraph [ [] block ] »va[
extended visual commands (v g): top row ctrl g^q g^w g^e g^r g^t g^y g^u g^i g^o g^p g^[ »esc g^]
extended visual commands (v g): top row shift gQ gW gE gR gT gY gU gI gO gP g{ g}
extended visual commands (v g): top row gq format gw format still ge gr gt gy gu gi go gp g[ g]
additional commands (z): top row ctrl z^q z^w z^e z^r z^t z^y z^u z^i z^o z^p z^[ »esc z^]
additional commands (z): top row shift zQ zW temp misspelling zE eliminate folds zR open all folds zT zY zU zI zO open folds recursively zP z{ z}
additional commands (z): top row zq zw add misspelling ze cursor at right side zr reduce folding zt line at top zy zu· undo spelling zi toggle all folds zo open fold zp z[ z]
normal mode: home row ctrl ^a increment ^s (xoff) ^d scroll down ^f page down ^g :file (info) ^h »h ^j »j ^k ^l redraw ^ to mode/extensions
normal mode: home row shift A append to eol S subst line D delete to eol backwd to char G eof/goto ln H screen top J join lines K help L screen bottom : ex cmd line use register | goto (1st) col
normal mode: home row a append s subst char d delete fwd to char extra cmds hjkl; repeat t/f/T/F goto mark bol reserved
quit commands: home row ctrl Z^a Z^s Z^d Z^f Z^g Z^h Z^j Z^k Z^l Z^\
quit commands: home row shift ZA ZS ZD ZF ZG ZH ZJ ZK ZL Z: Z" Z|
quit commands: home row Za Zs Zd Zf Zg Zh Zj Zk Zl Z; Z' Z\
backward search commands ([): home row ctrl [^a [^s [^d to definition [^f [^g [^h [^j [^k [^l [^\
backward search commands ([): home row shift [A [S last bad word [D definition [F [G [H [J [K [L [: [" [|
backward search commands ([): home row [a [s last misspelling [d define line [f »gf [g [h [j [k [l [; [' »[` ^ [\
forward search commands (]): home row ctrl ]^a ]^s ]^d to next define ]^f ]^g ]^h ]^j ]^k ]^l ]^\
forward search commands (]): home row shift ]A ]S next bad word ]D next define ]F ]G ]H ]J ]K ]L ]: ]" ]|
forward search commands (]): home row ]a ]s next misspelling ]d next define line ]f »gf ]g ]h ]j ]k ]l ]; ]' »]` ^ ]\
window commands (ctrl-w): home row ctrl ŵ^a ŵ^s ŵ^d ŵ^f ŵ^g ŵ^h ŵ^j ŵ^k ŵ^l ŵ^\
window commands (ctrl-w): home row shift ŵA ŵS »^ws ŵD ŵF ^wf, jump to line ŵG ŵH move far left ŵJ move to bottom ŵK move to top ŵL move far right ŵ: ŵ" ŵ| set width
window commands (ctrl-w): home row ŵa ŵs split horizontally ŵd split, to definition ŵf split, file edit ŵg· extra cmds ŵh go left ŵj go down ŵk go up ŵl go right ŵ; ŵ' ŵ\
extended window commands (ctrl-w g): home row ctrl ŵg^a ŵg^s ŵg^d ŵg^f ŵg^g ŵg^h ŵg^j ŵg^k ŵg^l ŵg^\
extended window commands (ctrl-w g): home row shift ŵgA ŵgS ŵgD ŵgF ^wgf, to linenr ŵgG ŵgH ŵgJ ŵgK ŵgL ŵg: ŵg" ŵg|
extended window commands (ctrl-w g): home row ŵga ŵgs ŵgd ŵgf file in tab ŵgg ŵgh ŵgj ŵgk ŵgl ŵg; ŵg' ŵg\
extended commands (g): home row ctrl g^a mem usage stats g^s g^d g^f g^g cursor pos info g^h select block g^j g^k g^l g^\
extended commands (g): home row shift gA gS gD global declaration gF edit file + jump gG gH select lines gJ join leave spacing gK gL g: g" g|
extended commands (g): home row ga char value gs sleep gd local declaration gf edit file at cursor gg first line gh select mode gj ▼ screen gk ▲ screen gl g; to prev change pos g'· to mark keepjumps g\
insert mode: home row ctrl ^a insert previous ^s »^s ^d unindent ^f set indentation ^ extra cmds ^h backspace ^j enter ^k·· digraph ^l im leave ins mode ^ »^\
insert mode: home row shift A S D F G H J K L : " |
insert mode: home row a s d f g h j k l ; ' \
extended insert commands (i ctrl-g): home row ctrl ĝ^a ĝ^s ĝ^d ĝ^f ĝ^g ĝ^h ĝ^j ĝ^k ĝ^l ĝ^\
extended insert commands (i ctrl-g): home row shift ĝA ĝS ĝD ĝF ĝG ĝH ĝJ ĝK ĝL ĝ: ĝ" ĝ|
extended insert commands (i ctrl-g): home row ĝa ĝs ĝd ĝf ĝg ĝh ĝj ▼ start column ĝk ▲ start column ĝl ĝ; ĝ' ĝ\
insert completion commands (i ctrl-x): home row ctrl ^a ^s spell suggest ^d define complete ^f file complete ^g ^h ^j ^k dict complete ^l line complete ^\
insert completion commands (i ctrl-x): home row shift x̂A x̂S x̂D x̂F x̂G x̂H x̂J x̂K x̂L x̂: x̂" x̂|
insert completion commands (i ctrl-x): home row x̂a x̂s »i^x^s x̂d x̂f x̂g x̂h x̂j x̂k x̂l x̂; x̂' x̂\
visual mode: home row ctrl ^a ^s »^s ^d »^d ^f »^f ^g select mode ^h backspace ^j »^j ^k ^l ^ »^\
visual mode: home row shift A append to block S replace lines D delete lines »F G »G H »H J join lines K help selection L »L : cmd on range " | »|
visual mode: home row extend area s »vc d delete area »f extra cmds h »h j »j k »k l »l ; »; ' \
text object selection (v a/i): home row ctrl ^a ^s ^d ^f ^g ^h ^j ^k ^l ^\
text object selection (v a/i): home row shift A S D F G H J K L : " »va' |
text object selection (v a/i): home row a s sentence d f g h j k l ; ' quoted string \
extended visual commands (v g): home row ctrl g^a g^s g^d g^f g^g g^h g^j g^k g^l g^\
extended visual commands (v g): home row shift gA gS gD gF gG gH gJ join literally gK gL g: g" g|
extended visual commands (v g): home row ga gs gd gf gg gh gj gk gl g; g' g\
additional commands (z): home row ctrl z^a z^s z^d z^f z^g z^h z^j z^k z^l z^\
additional commands (z): home row shift zA toggle fold recursively zS zD delete folds recursive zF fold lines zG temp spelling zH scroll ◀ half screen zJ zK zL scroll ▶ half screen z: z" z|
additional commands (z): home row za toggle fold zs cursor at left side zd delete fold zf create fold zg add spelling zh scroll ◀ zj next fold start zk prev fold end zl scroll ▶ z; z' z\
normal mode: bottom row ctrl ^z :suspend ^x substract ^c abort ^v visual block ^b page up ^n »j ^m »+ ^?
normal mode: bottom row shift quit X backspace C change to eol V visual lines B prev word N prev find M screen middle < unindent > indent find rev.
normal mode: bottom row extra cmds x delete char c change v visual mode b prev word n next find set mark , reverse t/T/f/F . repeat last cmd find
quit commands: bottom row ctrl Z^z Z^x Z^c Z^v Z^b Z^n Z^m Z^?
quit commands: bottom row shift ZZ :wq (write) ZX ZC ZV ZB ZN ZM Z< Z> Z?
quit commands: bottom row Zz Zx Zc Zv Zb Zn Zm Z, Z. Z/
backward search commands ([): bottom row ctrl [^z [^x [^c [^v [^b [^n [^m [^?
backward search commands ([): bottom row shift [Z [X [C [V [B [N [M [< [> [?
backward search commands ([): bottom row [z start of open fold [x [c start of change backwards [v [b [n [m start of function [, [. [/ start of C comment
forward search commands (]): bottom row ctrl ]^z ]^x ]^c ]^v ]^b ]^n ]^m ]^?
forward search commands (]): bottom row shift ]Z ]X ]C ]V ]B ]N ]M ]< ]> ]?
forward search commands (]): bottom row ]z end of open fold ]x ]c start of change forwards ]v ]b ]n ]m end of function ], ]. ]/ end of C comment
window commands (ctrl-w): bottom row ctrl ŵ^z ŵ^x ŵ^c abort ŵ^v ŵ^b ŵ^n ŵ^m ŵ^?
window commands (ctrl-w): bottom row shift ŵZ ŵX ŵC ŵV ŵB ŵN ŵM ŵ< width decrease ŵ> width increase ŵ?
window commands (ctrl-w): bottom row ŵz close preview ŵx exchange ŵc :close ŵv split vertically ŵb go to bottom ŵn open new ŵm ŵ, ŵ. ŵ/
extended window commands (ctrl-w g): bottom row ctrl ŵg^z ŵg^x ŵg^c ŵg^v ŵg^b ŵg^n ŵg^m ŵg^?
extended window commands (ctrl-w g): bottom row shift ŵgZ ŵgX ŵgC ŵgV ŵgB ŵgN ŵgM ŵg< ŵg> ŵg?
extended window commands (ctrl-w g): bottom row ŵgz ŵgx ŵgc ŵgv ŵgb ŵgn ŵgm ŵg, ŵg. ŵg/
extended commands (g): bottom row ctrl g^z g^x g^c g^v g^b g^n g^m g^?
extended commands (g): bottom row shift gZ gX gC gV avoid reselection gB gN gM g< see prev cmd output g> g? rot13 encode
extended commands (g): bottom row gz gx NetrwBrowseX gc gv previous highlight gb gn gm center screen g, to next change pos g. g/
insert mode: bottom row ctrl ^z :suspend in im ^ expand mode ^c abort, no abbr ^v literal or charcode ^b former i^_ ^n find next keyword ^m enter ^?
insert mode: bottom row shift Z X C V B N M < > ?
insert mode: bottom row z x c v b n m , . /
extended insert commands (i ctrl-g): bottom row ctrl ĝ^z ĝ^x ĝ^c ĝ^v ĝ^b ĝ^n ĝ^m ĝ^?
extended insert commands (i ctrl-g): bottom row shift ĝZ ĝX ĝC ĝV ĝB ĝN ĝM ĝ< ĝ> ĝ?
extended insert commands (i ctrl-g): bottom row ĝz ĝx ĝc ĝv ĝb ĝn ĝm ĝ, ĝ. ĝ/
insert completion commands (i ctrl-x): bottom row ctrl ^z ^x ^c ^v ex cmd complete ^b ^n next complete ^m ^?
insert completion commands (i ctrl-x): bottom row shift x̂Z x̂X x̂C x̂V x̂B x̂N x̂M x̂< x̂> x̂?
insert completion commands (i ctrl-x): bottom row x̂z x̂x x̂c x̂v x̂b x̂n x̂m x̂, x̂. x̂/
visual mode: bottom row ctrl ^z »^z ^x ^c abort ^v blockwise ^b »^b ^n »^n ^m »^m ^?
visual mode: bottom row shift Z X »vD C replace full lines V linewise B »B N »N M »M < unindent > indent »?
visual mode: bottom row »z x »vd c replace area v charwise b »b n »n »m , . »/
text object selection (v a/i): bottom row ctrl ^z ^x ^c ^v ^b ^n ^m ^?
text object selection (v a/i): bottom row shift Z X C V B {} Block N M < <> block > »va< ?
text object selection (v a/i): bottom row z x c v b () block n m , . /
extended visual commands (v g): bottom row ctrl g^z g^x g^c g^v g^b g^n g^m g^?
extended visual commands (v g): bottom row shift gZ gX gC gV gB gN gM g< g> g? rot13 encode
extended visual commands (v g): bottom row gz gx gc gv »gv gb gn gm g, g. g/
additional commands (z): bottom row ctrl z^z z^x z^c z^v z^b z^n z^m line at top bol z^?
additional commands (z): bottom row shift zZ zX reapply folds zC close folds reccursively zV zB zN fold normal zM close all folds z< z> z?
additional commands (z): bottom row zz line at center zx update folds zc close fold zv unfold cursor line zb line at bot. bol zn fold none zm fold more z, z. line at center bol z/

info
Info command: shows/does something without altering anything.
motion
Moves the cursor, or defines the range for an operator (↕).
positioning
Other movement (jumps, window (re)positioning).
command
Direct action command.
ins mode
Enters Insert or Replace mode.
mode
Enters a different mode.
vis mode
Enters Visual or Select mode.
key cmd
Additional key commands (click for overview).
key·
Commands with a dot need a char argument afterwards.
key↕
Requires a motion afterwards, operates between cursor and destination.
vim
Not in original Vi (assessment incomplete).
vim7
New in vim version 7.x.