Vim Cheatsheet
May 02, 2019
Modes
Mode | Command | Description |
---|---|---|
NORMAL | esc | movement |
INSERT | i , a | editing |
VISUAL | v | selecting |
COMMAND | : | run vim commands |
Movement
Letter
Mode | Command | Description |
---|---|---|
NORMAL | j | down |
NORMAL | k | up |
NORMAL | l | right |
NORMAL | h | left |
Line
Mode | Command | Description |
---|---|---|
NORMAL | w | word start |
NORMAL | e | word end |
NORMAL | 0 | line start |
NORMAL | $ | line end |
File
Mode | Command | Description |
---|---|---|
NORMAL | ] | jump down to next empty line |
NORMAL | [ | jump up to next empty line |
NORMAL | gg | top |
NORMAL | G | bottom |
Files
Mode | Command | Description |
---|---|---|
NORMAL | Ctrl-o | back |
NORMAL | Ctrl-i | forward |
NORMAL | Ctrl-w v | new window to the right |
NORMAL | Ctrl-w l | move to right window |
NORMAL | Ctrl-w h | move to left window |
Editing
Mode | Command | Description |
---|---|---|
VISUAL | y | copy selected |
NORMAL | yy | copy line |
NORMAL | ye | copy until word end |
NORMAL | yi[x] | copy in x |
NORMAL | ya[x] | copy around x |
NORMAL | yt[x] | copy until x |
NORMAL | p | paste |
VISUAL | d | cut |
NORMAL | dd | cut line |
NORMAL | di[x] | cut in x |
NORMAL | da[x] | cut around x |
NORMAL | dt[x] | cut until x |
NORMAL | r[x] | replace character with x |
NORMAL | x | cut character |
NORMAL | o | new line and enter INSERT mode |
COMMAND | %s/[x]/[y]/g | replace [x] with [y] |
NORMAL | ysiw[x] | surround word with [x] |
NORMAL | yss[x] | surround line with [x] |
VISUAL | S[x] | surround selected with [x] |
NORMAL | ds[x] | remove surround matching [x] |
Workflow
Mode | Command | Description |
---|---|---|
NORMAL | q[x]...q | record ... macro to character [x] |
NORMAL | @[x] | replay macro stored at character[x] |
NORMAL | /[x] | search matching [x] |