documentation for commands can be found here
commands
from normal mode
| purpose | command |
|---|
| save and quit | shift+z, shift+z |
| save without quitting | :w |
| quit without saving | shift+z, shift+q |
| insert mode (equivalent to standard mode of other text editors) | i |
| search forward | /thing ur searching for+enter |
| search backward | ?thing ur searching for+enter |
| go to next occurrence of last search | /+enter or n |
| go to previous occurrence of last search | ?+enter or N |
| find and replace on current line | :s/pattern/replace/g |
| repeat last substitution on current line | & |
| find and replace in current file | :%s/pattern/replace/g |
| find last search and replace in current file | :%s//replace/g |
| undo | u |
| go to top of file | gg |
| go to bottom of file | G |
| select all text in a file | ggVG |
| paste into line below | p |
| delete selection | d |
| delete current line | dd |
| move current line down | ddp |
| move current line up | ddkP |
| copy current line/selection | yy |
| insert line above | O |
| insert line below | o |
| go to the beginning of the current line and switch to insert mode | I |
| go to the end of the current line and switch to insert mode | A |
| select the word under the cursor | viw |
| open link under the cursor | gx |
| move one word right | w |
| move one word left | b |
from visual mode
enter visual mode by using the mouse to select something, or by pressing v (or V to select whole line)
| purpose | command |
|---|
| toggle commenting of selecting lines | highlight lines, then gc |
| paste into selection | p |
other
| abbreviation | meaning |
|---|
| <.*> | keystroke |
| <CR> | enter (carriage return) |
| <C> | control |
| <S> | shift |
- the following characters need to be escaped when searching:
/ ~