Vim Bindings – Cheatsheet & Notes

Personal vim cheat sheet
impt: command + count + motion
Motions
– h,j,k,l
– w: word start (…W)
– e: word end (…E)
– b: backwards word (…B)
– ge: end of previous word
– gg: page top
– G: page bottom
– 0: beginning of the line index
– $: end of the line (trick: use “A” for the end of line + insert mode.)
– _: beginning of the line content (trick: use “I” for the beginning of line + insert mode.)
– {: move a block of lines up
– }: move to a block of lines down
– %: goto other pair of the parenthesis
– *: occurrence of the word
Commands
y: yank
d: delete (…D)
p: paste
x: delete letter (…X)
c: change (…C)
f: find letter and place cursor on it (…F) + “;” to goto next instance.
t: find letter and place cursor before it (…T) + “;” to goto next instance.
r: replace letter
yy: copy line
dd: delete line
u: undo
Ctrl + r: redo
i: insert mode - before cursor
a: insert mode - after cursor (append)
o: new line below & insert mode
O: new line above & insert mode
I: insert at the beginning of the line
A: append at the end of the line
v: visual mode
V: visual line mode
z: bring the line view to center
~: to toggle between upper and lower case
.: to execute last command
>>: indent right
<<: indent left
: - command mode
:39: jump to line number 39
:w - write file
:q - quit file
:q! - quit without saving
:wq - write and quit
macros: combination of commands you wanna store in a letter for later execution (just like “.” but on steroids)
- q
Tips:
- First master motions and essentials commands only, later expand your expertise to niche commands
- Use relative line numbers in editor
- Disable long press for accent characters i.e. long-press k should give kkkkkk and not ķ.
- Don’t stay inside insert mode for long because bindings won’t work (get back to normal mode asap)
- Learn and practice via game (if not via actual projects!)
- Recommended pre-requisite (optional): learn touch typing!
- If you’re really going keyboard native, i’d recommend vimium - use browser with vim bindings
PS:
- Games: vim genius | vim adventure
- Shoutout to ben | primeagen