Editing
- r - replace a single character
- J - join line below to the current one with one space in between
- gJ - join line below to the current one without space in between
- gwip - reflow paragraph
- cc - change (replace) entire line
- C - change (replace) to the end of the line
- c$ - change (replace) to the end of the line
- ciw - change (replace) entire word
- cw - change (replace) to the end of the word
- s - delete character and substitute text
- S - delete line and substitute text (same as cc)
- xp - transpose two letters (delete and paste)
- u - undo
- Ctrl + r - redo
- . - repeat last command
Marking text (visual mode)
- v - start visual mode, mark lines, then do a command (like y-yank)
- V - start linewise visual mode
- o - move to other end of marked area
- Ctrl + v - start visual block mode
- O - move to other corner of block
- aw - mark a word
- ab - a block with ()
- aB - a block with {}
- ib - inner block with ()
- iB - inner block with {}
- Esc - exit visual mode
Visual commands
- > - shift text right
- < - shift text left
- y - yank (copy) marked text
- d - delete marked text
- ~ - switch case
Registers
- :reg - show registers content
- "xy - yank into register x
- "xp - paste contents of register x
Tip Registers are being stored in ~/.viminfo, and will be loaded again on next restart of vim.
Tip Register 0 contains always the value of the last yank command.
Marks
- :marks - list of marks
- ma - set current position for mark A
- `a - jump to position of mark A
- y`a - yank text to position of mark A
Macros
- qa - record macro a
- q - stop recording macro
- @a - run macro a
- @@ - rerun last run macro