set number
set relativenumber
move
h => left
j => down
k => up
l => right
n + h/j/k/l => left/down/up/right jump n line
Insert mode
i => insert before cursor
o => insert a new line below cursor
a => insert after cursor
I => cursor jump to the beginning of the line
O => insert a new line above cursor
A => cursor jump to the end of the line
v => Visual mode
V => Visual line mode
ctrl + v => Visual block mode
d => delete (cut)
y => copy (yank)
c => change
Normal mode
D => delete rest of the line
dd => delete whole line
yy == Y => copy whole line
5yy => copy 5 line
C => change rest of the line
cc => change whole line
r => replace
R => replace mode
p => paste below
P => paste above
u => undo
5u => undo 5 times
ctrl + r => redo
w => jump to next word (separated by space or -)
W => jump to next word (separated by space)
b => jump to previous word (separated by space or -)
B => jump to previous word (separated by space)
e => jump to the end of a word
0 => jump to the beginning of a line
$ => jump to the end of a line
% => jump between { and }
d% => delete between { and }
dw => delete next word
d2w => delete next 2 words
db => delete previous word
d2b => delete previous 2 words
d0 => delete until to the beginning of the line
d$ => delete until to the end of the line
diw => delete in a word
ciw => change in a word
yiw => copy in a word
di" => delete inner "
ci" => change inner "
yi" => copy inner "
di( => delete inner ()
ci( => change inner ()
yi( => copy inner ()
t* => jump to the position before next *
f* => jump to the next *
T* => jump to the position after previous *
F* => jump to the previous *
dt( => delete everything up until (
gg => jump to beginning of the file
G => jump to end of the file
15G == :15 => jump to line number 15
== => indented line
gg=G => indented all line in the file
search
/ => search
n => go next
N => go back up
? => reverse search
n => go back up
N => go next
# => search word upward
* => search word downward
ma => mark as “a” way point
'a => jump to the “a” way point
zz => scroll cursor to screen center
:%s/A/B/g => full file replace A to B
:s/A/B/g => replace A to B in selected lines (Visual mode)
. => repeat command
:reg => view registers (copy delete history)
"3p => paste name "3 register
qa + some actions + q => record the macro as name “a”
@a => execute macro “a"