6 min read
On this page

Vim Motions

You Don't Need to Use Vim

Let's get this out of the way immediately. This is not about convincing you to use Vim as your editor. VS Code, JetBrains IDEs, Zed, Sublime Text — they're all excellent editors with features that Vim purists love to pretend don't matter.

This is about Vim motions — the movement and editing language that Vim invented. You can use Vim motions in every major editor through plugins:

VS Code:       Vim extension (vscodevim)
JetBrains:     IdeaVim (built-in plugin)
Zed:           Native Vim mode
Sublime Text:  Vintage mode or NeoVintageous

Enable the plugin, and you get Vim's editing language inside your familiar editor with all its features intact — autocomplete, debugging, git integration, extensions, everything. You lose nothing and gain a dramatically more efficient way to edit text.

Why Vim Motions Are Faster

Normal text editing works like this: move your hand to the mouse, click where you want to edit, move your hand back to the keyboard, type your change. Or: hold Shift and press arrow keys repeatedly to select text, then type.

Vim motions work like this: your hands never leave the home row, and you express edits as composable commands. "Delete the word" is dw. "Change the text inside these quotes" is ci". "Delete from here to the end of the line" is d$.

The key insight is that Vim motions are a language, not a list of shortcuts. You learn verbs (delete, change, yank), nouns (word, line, paragraph, inside brackets), and modifiers (forward, backward, count). Then you compose them. Once you understand the grammar, you can express edits you've never explicitly learned.

Vim has modes. This is the concept that confuses beginners most, but it's also the source of Vim's power.

Normal mode  - Navigate and manipulate text (where you spend most time)
Insert mode  - Type text (like a regular editor)
Visual mode  - Select text
Command mode - Execute commands (save, quit, search)

In a regular editor, every key you press inserts a character. This means all editing commands need modifier keys (Ctrl, Alt, Shift). Vim's Normal mode frees the entire keyboard for navigation and editing commands, which is why Vim motions can use simple, memorable single-key commands.

Switching between modes

Esc or Ctrl+[     Return to Normal mode (from any mode)
i                  Enter Insert mode at cursor
a                  Enter Insert mode after cursor
o                  Enter Insert mode on new line below
O                  Enter Insert mode on new line above
v                  Enter Visual mode (character selection)
V                  Enter Visual mode (line selection)
Ctrl+v             Enter Visual Block mode (column selection)
:                  Enter Command mode

The golden rule: when you're done typing, press Escape to return to Normal mode. Normal mode is home base. If you're ever confused about what mode you're in, press Escape twice and you're back in Normal mode.

The Essential Motions

Basic movement (replace arrow keys)

h    Left
j    Down
k    Up
l    Right

Yes, these feel strange at first. Give it three days. After that, reaching for arrow keys will feel like reaching for the mouse — unnecessary movement away from the home row.

Word movement (the first big upgrade)

w    Jump forward to start of next word
b    Jump backward to start of previous word
e    Jump forward to end of current/next word
W    Jump forward to next WORD (whitespace-delimited)
B    Jump backward to previous WORD

The difference between w and W: w treats punctuation as word boundaries (foo.bar is three words), while W treats only whitespace as boundaries (foo.bar is one WORD). Use w for precise navigation, W for fast navigation.

Line movement

0    Go to start of line
^    Go to first non-blank character of line
$    Go to end of line

Character finding (the second big upgrade)

f{char}    Jump to next occurrence of {char} on current line
F{char}    Jump to previous occurrence of {char}
t{char}    Jump to just before next occurrence of {char}
T{char}    Jump to just after previous occurrence of {char}
;          Repeat the last f/F/t/T motion forward
,          Repeat the last f/F/t/T motion backward

This is incredibly useful. To jump to the opening parenthesis on the current line: f(. To jump to the equals sign: f=. To jump to the third comma: 3f,.

t is like f but stops one character before the target. This matters when combining with editing commands: dt) means "delete from here to just before the closing paren."

Larger movements

gg       Go to top of file
G        Go to bottom of file
{num}G   Go to line {num}
{        Jump to previous blank line (paragraph up)
}        Jump to next blank line (paragraph down)
Ctrl+d   Scroll half page down
Ctrl+u   Scroll half page up
%        Jump to matching bracket/parenthesis

The Editing Language

Here's where Vim motions become truly powerful. Editing commands follow a grammar:

{verb}{motion}   - Perform {verb} over the range defined by {motion}
{verb}{count}{motion} - Same, but repeat the motion {count} times

Verbs

d    Delete (cut)
c    Change (delete and enter Insert mode)
y    Yank (copy)
>    Indent
<    De-indent

Composing verbs and motions

dw     Delete from cursor to start of next word
d$     Delete from cursor to end of line
dd     Delete entire current line
d3w    Delete 3 words
dG     Delete from cursor to end of file
diw    Delete inner word (the word under cursor)

cw     Change word (delete word, enter Insert mode)
c$     Change to end of line
cc     Change entire line
ci"    Change inside quotes
ci(    Change inside parentheses

yw     Yank (copy) word
yy     Yank entire line
y3j    Yank current line and 3 lines below

Text objects (the third big upgrade)

Text objects define regions of text based on structure. They use i (inner — excludes delimiters) and a (around — includes delimiters).

iw    Inner word
aw    A word (includes surrounding space)
i"    Inside double quotes
a"    Around double quotes (includes the quotes)
i'    Inside single quotes
i(    Inside parentheses     (also: ib)
a(    Around parentheses
i{    Inside curly braces    (also: iB)
a{    Around curly braces
i[    Inside square brackets
i<    Inside angle brackets
it    Inside HTML/XML tag
at    Around HTML/XML tag
ip    Inner paragraph
ap    A paragraph

These compose with any verb:

ci"    Change the text inside double quotes
da(    Delete the parentheses and everything inside them
yi{    Yank everything inside curly braces
vit    Visually select inside an HTML tag
>ip    Indent the current paragraph

This is why Vim users call it a language. You didn't memorize ci" as a specific shortcut. You learned c (change), i (inner), and " (quotes), and composed them. You can now immediately use di" (delete inside quotes), yi" (yank inside quotes), vi" (select inside quotes) without any additional memorization.

Visual Mode

Visual mode lets you select text and then apply a command to the selection. It's Vim's equivalent of click-and-drag, but controlled entirely from the keyboard.

v      Character-wise visual selection
V      Line-wise visual selection
Ctrl+v Block (column) visual selection

Once in Visual mode, use any motion to extend the selection, then apply a verb:

viw    Select the current word
V3j    Select current line and 3 lines below
vip    Select current paragraph
Ctrl+v 3j I // Esc   Comment out 4 lines (block mode insert)

Visual Block mode (Ctrl+v) is particularly powerful for column editing:

# Select a column of text across multiple lines
# Press I to insert before the block, or A to append after
# Type your text, press Escape — it appears on every line

Practical Editing Patterns

Here are real editing scenarios and the Vim motions that handle them:

Scenario: Change a function argument
  Position cursor on the argument
  ci(    Change everything inside the parentheses

Scenario: Delete everything inside a string
  Position cursor anywhere inside the string
  di"    Delete inside quotes (or di' for single quotes)

Scenario: Duplicate a line and modify it
  yy     Yank the line
  p      Paste below
  cw     Change the first word that differs

Scenario: Swap two lines
  dd     Delete current line
  p      Paste it below the next line (or P for above)

Scenario: Delete from cursor to a specific character
  dt;    Delete up to (but not including) the semicolon

Scenario: Wrap a word in quotes
  ciw"Ctrl+r""    (Change inner word, type quote, paste original, type quote)
  Or in Visual mode: viw, then use surround plugin

Scenario: Indent a block of code
  >ip    Indent inner paragraph
  Or V, select lines, then >

Scenario: Replace all occurrences of a word in the file
  :%s/oldword/newword/g

The Learning Curve

Vim motions have a real learning curve. The first week is painful. You'll be slower than before. This is normal and temporary.

Week 1: Survival

Learn hjkl, i, Esc, w, b, dd, u (undo), and p (paste). Use these exclusively. Don't worry about efficiency — just stay in the Vim mindset.

Weeks 2-3: Building vocabulary

Add f/t character finding, ci/di text objects, and Visual mode. These are the features that start making Vim motions feel powerful rather than just different.

Weeks 4-6: Fluency

Commands start becoming automatic. You stop thinking "I need to change inside quotes" and just type ci". You start combining motions you learned separately into new combinations without conscious effort.

Month 2 and beyond: Mastery

Vim motions become invisible infrastructure. You think about edits in terms of intent ("change this function's arguments") and your fingers translate that intent into keystrokes without conscious thought.

Common Pitfalls

Going cold turkey. Don't force yourself to use Vim motions for everything on day one. Most Vim extensions in editors let you toggle Vim mode on and off. Turn it on for focused editing sessions and off when you need to be productive right now.

Trying to learn too many motions at once. Start with movement (hjkl, w, b) and one editing verb (d). Add one new concept per week.

Ignoring text objects. If you learn Vim motions but skip text objects (ci", da(, diw), you're missing the most useful part. Text objects are what make Vim motions a language instead of a set of shortcuts.

Not practicing deliberately. Reading about Vim motions doesn't build muscle memory. Practice them during actual editing work, even when it's slow at first. Consider using vimtutor (built into most systems) for structured practice.

Getting stuck in Insert mode. New Vim users spend too long in Insert mode, navigating with arrow keys like a normal editor. Force yourself to press Escape after every edit and navigate in Normal mode.

Key Takeaways

Vim motions are an editing language, not a set of shortcuts. Learn the verbs (d, c, y), the motions (w, b, f, $), and the text objects (iw, i", i(), and you can compose hundreds of editing commands from a small vocabulary.

You don't need to use Vim. Every major editor has a Vim motions plugin. Use it inside your existing editor and keep all the features you rely on.

The essential set is smaller than you think: hjkl, w/b, f/t, ci/di with text objects, dd/yy/p, and Visual mode. These cover the vast majority of daily editing.

The learning curve is real but short. Invest 2-3 weeks of slightly slower editing and you'll be faster than before for the rest of your career.

Text objects (ci", da(, yiw) are the feature that makes Vim motions dramatically better than keyboard shortcuts. If you learn nothing else, learn text objects.