Info
I’ve been trying to learn vim movements lately, and have installed the vim extension on my vscode as well as obsidian. Not entirely sure why, but I’ll leave this cheat-sheet here to save my own ass when I forget how to exit a file.
Vim Essential Movements Cheat Sheet
Basic Cursor Movement
h j k l ← ↓ ↑ → (basic movement)
w Jump to start of next word
b Jump to start of previous word
e Jump to end of current/next word
ge Jump to end of previous word
0 Jump to start of line
$ Jump to end of line
^ Jump to first non-blank character of line
Vertical Movement
gg Go to first line of document
G Go to last line of document
:n Jump to line n
Ctrl+u Page up (half screen)
Ctrl+d Page down (half screen)
{ Jump to previous paragraph/block
} Jump to next paragraph/block
Screen Movement
H Jump to top of screen (High)
M Jump to middle of screen (Middle)
L Jump to bottom of screen (Low)
zz Center current line on screen
zt Move current line to top of screen
zb Move current line to bottom of screen
Word/Character Search
f<char> Jump forward to next occurrence of <char>
F<char> Jump backward to previous occurrence of <char>
t<char> Jump forward before next occurrence of <char>
T<char> Jump backward before previous occurrence of <char>
; Repeat last f, F, t, or T movement
, Repeat last f, F, t, or T movement backwards
Pattern Search
/pattern Search forward for pattern
?pattern Search backward for pattern
n Jump to next search match
N Jump to previous search match
* Search forward for word under cursor
# Search backward for word under cursor
Marks and Jumps
m<char> Set mark at current position (a-z local, A-Z global)
'<char> Jump to line of mark <char>
`<char> Jump to position of mark <char>
`` Jump back to last jump position
Ctrl+o Jump to previous position in jump list
Ctrl+i Jump to next position in jump list
Text Objects (used with operators)
iw Inner word
aw A word (includes surrounding space)
is Inner sentence
as A sentence
ip Inner paragraph
ap A paragraph
i" Inside double quotes
a" Including double quotes
i' Inside single quotes
a' Including single quotes
i) Inside parentheses
a) Including parentheses