Back to blog
May 07, 2025
7 min read

Vim Motions Cheat Sheet

A concise cheat sheet for Vim motions, formatted for easy use in Astro projects.

What Are Vim Motions?

Vim motions are commands that allow you to move the cursor efficiently within a file. They are the foundation of Vim’s powerful editing capabilities, as they can be combined with operators (like d for delete, y for yank, or c for change) to perform complex text manipulations with minimal keystrokes. Motions can be used to navigate by characters, words, lines, paragraphs, sentences, or even search patterns.

You Don’t Need Vim to Use Vim Motions

You don’t need to use the Vim editor to start learning Vim motions. If you’re already comfortable with VS Code, you can use Vim motions by installing the popular Vim extension for VS Code. This extension brings Vim-like keybindings and motions to VS Code, allowing you to practice and get used to Vim’s navigation and editing style.

Once you’re comfortable with Vim motions in VS Code, you can easily transition to the Vim editor for an even more powerful and efficient workflow.

Types of Motions

TypeDescription
Character MotionsMove the cursor by individual characters.
Word MotionsJump between words or WORDS (ignoring punctuation).
Line MotionsNavigate to the start, end, or specific parts of a line.
Paragraph/SentenceMove between logical blocks of text.
Search MotionsQuickly find specific text or patterns.
Screen MotionsNavigate relative to the visible portion of the screen.
Text Object MotionsOperate on logical text objects like words, sentences, or paragraphs.
Mark and Jump MotionsJump to specific marks or previous positions in the file.

Why Use Motions?

BenefitDescription
EfficiencyMotions reduce the need for repetitive arrow key presses.
PrecisionThey allow you to target specific parts of your text with ease.
CombinationWhen combined with operators, motions enable powerful editing workflows.

For example, daw deletes a word, including surrounding spaces.


Learn More

Character Motions

CommandDescription
hMove left (←)
lMove right (→)

Word Motions

CommandDescription
wMove to the start of the next word
WMove to the start of the next word (ignores punctuation)
eMove to the end of the current/next word
EMove to the end of the current/next word (ignores punctuation)
bMove to the start of the previous word
BMove to the start of the previous word (ignores punctuation)

Line Motions

CommandDescription
0Move to the beginning of the line
^Move to the first non-whitespace character of the line
$Move to the end of the line

Paragraph Motions

CommandDescription
{Move to the beginning of the current/previous paragraph
}Move to the end of the current/next paragraph

Search Motions

CommandDescription
/patternSearch forward for pattern
?patternSearch backward for pattern
nRepeat the last search forward
NRepeat the last search backward

Sentence Motions

CommandDescription
(Move to the beginning of the current/previous sentence
)Move to the beginning of the next sentence

Screen Motions

CommandDescription
HMove to the top of the screen
MMove to the middle of the screen
LMove to the bottom of the screen

Scrolling

CommandDescription
Ctrl-dScroll down half a screen
Ctrl-uScroll up half a screen
Ctrl-fScroll down a full screen
Ctrl-bScroll up a full screen
zzCenter the current line in the screen

Search for Matching

CommandDescription
%Jump to the matching parenthesis, bracket, or brace

Text Object Motions

CommandDescription
awA word (including surrounding spaces)
iwInner word (excluding surrounding spaces)
aWA WORD (ignores punctuation, includes spaces)
iWInner WORD (ignores punctuation, excludes spaces)
apA paragraph (including surrounding spaces)
ipInner paragraph (excluding surrounding spaces)
asA sentence (including surrounding spaces)
isInner sentence (excluding surrounding spaces)

Mark and Jump

CommandDescription
''Jump to the position before the last jump
````Jump to the position before the last edit
g;Jump to the last change
g,Jump to the next change

Line Number Motions

CommandDescription
ggGo to the beginning of the file
GGo to the end of the file
nGGo to line n

Search for Characters

CommandDescription
f<char>Move to the next occurrence of <char> on the current line
F<char>Move to the previous occurrence of <char> on the current line
t<char>Move to just before the next occurrence of <char> on the current line
T<char>Move to just before the previous occurrence of <char> on the current line
;Repeat the last f, F, t, or T motion forward
,Repeat the last f, F, t, or T motion backward

Visual Mode Motions

CommandDescription
vStart visual mode
VStart visual line mode
Ctrl-vStart visual block mode