| Command | Description |
|---|---|
:help<Enter> |
help |
<Esc> |
back to normal mode |
V |
visual line mode |
i |
insert mode |
: |
command-line mode |
:set tw=72 |
set text width to 72 |
<F11> |
paste mode |
<Esc>!!date |
insert date |
qa |
record keystrokes into register a |
q |
stop recording |
@a |
execute keystrokes from register a |
%s/from/to/g |
replace string in whole file |
<Esc>:wq! |
force write and quit |
<Esc>:q! |
force quit and dont write |
i insert before cursorI insert at beginning of linea append after cursorA append at end of lineo open new line belowO open new line abovev visual mode (character)V visual line mode<Ctrl-v> visual block mode<Esc> back to normal modeh j k l left / down / up / rightw next wordb previous worde end of word0 beginning of line^ first non-blank character$ end of linegg beginning of fileG end of file:n go to line n% jump to matching bracketx delete characterdd delete lineyy yank (copy) linep paste after cursorP paste before cursoru undo<Ctrl-r> redor replace single charactercw change wordcc change line>> indent line<< unindent line. repeat last command/text search forward?text search backwardn next matchN previous match:%s/old/new/g replace in whole file:%s/old/new/gc replace with confirmation:w write file:q quit:wq write and quit:q! quit without saving:e file edit file:split file horizontal split:vsplit file vertical split<Ctrl-w> w switch windowqa record macro in register aq stop recording@a run macro a"ayy yank into register a"ap paste from register a:set number show line numbers:set relativenumber show relative numbers:set expandtab use spaces instead of tabs:set tabstop=4 tab width:set shiftwidth=4 indent width:set ignorecase case-insensitive search:set smartcase smart case searchd + w → dw (delete word)c + $ → c$ (change to end of line)5dd delete 5 lines3w move 3 words. to repeat the last change