Getting Started

If you haven't done vimtutor yet,it's a great place to start learning vim. It's an interactive tutorial that is already installed on your computer. Open up terminal, type vimtutor and hit enter.

vimtutor opening a file

Quitting Vim

ZZ - Write file (if changed) and quit. :wqa - Write all changed buffers and exit Vim :xa - Write all changed buffers and exit Vim

Saving a file

:w - Write the current file

Motion Commands

h - (left) j - (down) k - (up) l - (right) w - move forward one word W - move forward one WORD b - move back one word B - move back one WORD e - move to end of word E - move to end of WORD ge - move backwards to end of word gE - move backwards to end of WORD $ - move to end of line 0 - move to beginning of line ^ - move to first non-whitespace character g_ - move to last non-whitespace character t{char} and T{char} - move to character before {char} f{char} and F{char} - move to {char} % - jump to matching parentheses or curly brace.

Insert mode

i and I a and A o and O i_esc i_CTRL-C

Deleting

x - delete the character under cursor dd - delete the entire line dw - delete a word das - delete a sentence dat - delete a tag dap - delete a paragraph

Changes

u - undo ctrl-r - redo

File Navigation

CTRL-D - scroll down half page CTRL-U - scroll up half page CTRL-F - scroll forward (down) full page CTRL-B - scroll back (up) full page CTRL-E - scroll forward (down) one line CTRL-Y - scroll back (up) one line Goto line