Tools
Vim Cheat Sheet — Commands & Shortcuts
Vim commands grouped by mode and task. Most commands run in normal mode — press Esc to get there.
Advertisement
Modes
EscReturn to normal modei / aInsert before / after the cursorI / AInsert at start / end of the lineo / OOpen a new line below / abovev / VVisual mode / visual line modeCtrl-vVisual block modeMovement
h j k lLeft, down, up, rightw / bForward / back one word0 / $Start / end of the linegg / GTop / bottom of the file:42Jump to line 42Ctrl-d / Ctrl-uHalf page down / up{ / }Previous / next paragraphEditing
xDelete the character under the cursorddDelete (cut) the whole lineyyYank (copy) the linep / PPaste after / before the cursordw / cwDelete / change a worduUndoCtrl-rRedo.Repeat the last changeSearch & replace
/textSearch forward (n / N for next / previous)?textSearch backward:%s/old/new/gReplace every occurrence in the file:%s/old/new/gcReplace all, confirming each one*Search for the word under the cursorFiles & quitting
:wSave:qQuit:wq or ZZSave and quit:q!Quit without saving:e fileOpen another file:sp / :vspSplit horizontally / vertically