Vim commands cheat sheet
Every command practiced in hjkl, grouped by skill. Run them in Normal mode; press Escape to get back to Normal from Insert or Visual mode.
Fix a typo
| Keys | Action |
|---|---|
| x | Delete character |
| h l | Move left / right |
Change a word
| Keys | Action |
|---|---|
| w b | Move by word |
| ciw | Change inner word |
Remove a line
| Keys | Action |
|---|---|
| j k | Move down / up |
| dd | Delete line |
Trim a phrase
| Keys | Action |
|---|---|
| v | Start selection |
| h l | Extend selection |
| d | Delete selection |
Move a sentence
| Keys | Action |
|---|---|
| dd | Cut line |
| j k | Move down / up |
| p | Put after |
Insert text
| Keys | Action |
|---|---|
| i a | Insert before / after |
| I A | Start / end of line |
| o O | New line below / above |
Replace a character
| Keys | Action |
|---|---|
| r | Replace character |
Copy text
| Keys | Action |
|---|---|
| yy yw | Copy line / word |
| p P | Put after / before |
Use counts
| Keys | Action |
|---|---|
| 3w | Move three words |
| 2dd 3x | Delete several |
| 3p | Put three times |
Find within a line
| Keys | Action |
|---|---|
| f F | Find forward / backward |
| t T | Stop before / after |
| ; , | Repeat / reverse find |
Search documents
| Keys | Action |
|---|---|
| / ? | Search forward / backward |
| n N | Next / previous match |
Edit text objects
| Keys | Action |
|---|---|
| ci" ci' ci( | Change inside delimiters |
| diw daw | Delete inner / whole word |
Repeat edits
| Keys | Action |
|---|---|
| . | Repeat the last change |
Match delimiters
| Keys | Action |
|---|---|
| % | Jump to the matching delimiter |
Jump through files
| Keys | Action |
|---|---|
| 12G | Jump to a numbered line |
| gg G | First / last line |
| ctrl-o ctrl-i | Back / forward through jumps |
Set and return to marks
| Keys | Action |
|---|---|
| ma | Set mark a |
| 'a `a | Return to its line / exact position |