Vim strategic motions
Vertical Motion
-
Go to specified line:
line number + gg
Example:25gg(go to line 25)
-
Move up/down with relative line numbers:
10k→ go up 10 lines9j→ go down 9 lines
-
Move the cursor line on the screen in normal mode:
zz– center the linezt– move to the topzb– move to the bottom
-
Scroll half a screen:
CTRL + d→ half screen downCTRL + u→ half screen up
-
Scroll a screen:
CTRL + f→ a screen downCTRL + b→ a screen up
Horizontal Motion
-
Jump by whitespace:
B→ previous whitespaceW→ next whitespace
-
f-jumps (character search within a line):
f<char>→ jump to the first occurrence of<char>in the line.
Press;to go to the next occurrence.F<char>→ jump backwards to the previous occurrence of<char>in the line.
Press;to go to the next occurrence.
Pattern Jumping
vi(→ visually highlight inside()vi"→ visually highlight inside""yi(→ yank inside()va(→ visually highlight around()ya(→ yank around()
Jump List
CTRL + o↔CTRL + i
Jump between last cursor positions