2008-07-10

Vim cheatsheet

modes

  • normal (command) - enter editor commands (default mode)
  • visual - like normal, but movement commands extend highlighted area
  • select - typing a printable character deletes the selection and starts insert mode
  • insert - everything you type is inserted in the buffer until you press Esc
  • cmdline - you can enter one line of command at the bottom of the window
  • ex - like command line, but after entering a command you remain in the ex mode

commands

quit
without writing changes :q!/ZQ, write changes & quit :wq/:x/ZZ
file
read :e {file}, write :w {file}
cursor
j/k/h/l, word w/b, WORD W/B, word-end e/ge
to first/firstnonempty/last char in line 0/^/$, to first/last line in window H/L
insert
before/at cursor i/a, at line beginning/end I/A, new line below/above o/O
complete
word C-n/C-p, line C-xC-l
delete
d, char at/before cursor x/X, line dd
undo
u, redo C-r, undo changes to current line U
search
pattern forward/backward //?, word under cursor forward/backward */#, next/prev match n/N
char fF, till tT, match bracket %
repeat command
.

No comments: