Normal mode
navigate the text, copy/cut/paste, but also roll-back actions, and so on
basic
- Esc or Ctrlc exit from any mode back to normal mode
- u undo
- Ctrlr redo
- `` go to previous cursor position
- `. go to previous edit position
- ; repeat last command
- . repeat last text-changing command
navigation
- h left / j down / k up / l right
- example: 4j moves down 4 lines
- w / e go to start / end of next word (punctuation separated)
- W / E go to start / end of next word (space separated)
- b / ge go to start / end of previous word (punctuation separated)
- B / gE go to start / end of previous word (space separated)
- ( / ) go backward / forward by sentences
- { / } go backward / forward by paragraph
- % go to next (or matching) brackets / parentheses / braces
- 0 / $ go to start / end of line
- ^ go to first non-blank character of line
- gg / G go to first / last line of file
- example: 3G go to line 3
- H / M / L move cursor to the highest / middle / lowest line of the screen
- Ctrlb / Ctrlf scroll a full page up / down
- Ctrlu / Ctrld scroll a half page up / down
- zt / zz / zb scroll the current line to the top / middle / bottom of the screen
- zH / zL scroll half screen to left / right
- za toggle current code fold
- zo / zc open / close current code chunk
- zR / zM open / close all code chunks in file
editing
- dd delete (cut) entire line
- d$ or D delete (cut) from cursor to the end of line
- examples: d3w d5j etc.
- dit delete (cut) text inside html tag
- di' delete (cut) text inside single quotes, idem for "([{`<
- dat delete (cut) html tag and text inside
- da' delete (cut) single quotes and text inside, idem for "([{`<
same for yank (copy to vim clipboard): examples: yy y$ etc.
- x / X delete (cut) character after / before cursor
- p / P put (paste) the vim clipboard after / before cursor
- "*y copy to the system clipboard
- "*p paste from the system clipboard
- >> / << increase / decrease indent for line
- example: >5j etc.
- g~~ toggle upper / lower case for the line
- gUU / guu make upper / lower case for the line
- example: gUw gU$ etc.
J / gJ join current line with next line with / without a space between
seek / search
- f█ seek forwards to the next instance of █
- F█ seek backwards to the next instance of █
- t█ seek forwards until adjacent to the next instance of █
- T█ seek backwards until adjacent to the next instance of █
- ; / , repeat seek forwards / backwards
- /█ search forwards for regex pattern █
- ?█ search backwards for regex pattern █