Modes, motion, editing and search — the Vim commands that get you productive fast. Tap to copy.
iEnter insert mode before the cursoraEnter insert mode after the cursorEscReturn to normal mode:wSave the file:qQuit:wqSave and quit:q!Quit without savingh j k lMove left, down, up, rightwJump to the start of the next wordbJump back to the previous word0Go to the start of the line$Go to the end of the lineggGo to the first lineGGo to the last line:42Jump to line 42xDelete the character under the cursorddDelete the current lineyyCopy (yank) the current linepPaste after the cursoruUndoCtrl + rRedodwDelete to the end of the wordccChange (replace) the whole line/textSearch forward for textnJump to the next search matchNJump to the previous match:%s/old/new/gReplace every occurrence in the file:%s/old/new/gcReplace with confirmation for eachThe mental model: normal mode for moving and commands, insert mode (press i) for typing, and Esc to get back. Master a few motions (w, b, 0, $, gg, G) and edits (dd, yy, p, u) and the rest follows. To save and quit, type :wq.