Neovim text objects: the shortcuts nobody tells beginners
You know operators (d, c, y) and you know motions (w, $, f). Text objects are the third piece — and they're the one that makes people say "oh, that's why Vim is fast."
A text object selects a chunk of text by structure: a word, a sentence, everything inside quotes, everything inside parentheses. Combine them with operators and you get surgical editing that doesn't care where your cursor is.
Inner vs Around
Every text object comes in two flavors:
i(inner) — just the contents, not the delimitersa(around) — the contents plus the surrounding characters
Why they're powerful
The key insight: your cursor doesn't have to be on the delimiter. Type ci" anywhere inside a quoted string and it clears the contents and drops you into insert mode. You don't need to navigate to the opening quote first.
Same with ci( — cursor anywhere inside the parentheses, the whole contents get replaced. This is why experienced Vim users rarely navigate to exact positions before editing. They jump roughly to the right area and let text objects handle the precision.
Common real-world uses
- Rename a variable: cursor on it →
ciw→ type new name - Replace a string: cursor inside quotes →
ci"→ type new string - Delete a function's arguments: cursor inside parens →
di( - Copy a paragraph: cursor anywhere in it →
yap - Delete an HTML tag's content: cursor inside →
cit
v then i" to select inside quotes, ip to select a paragraph, i{ to select inside braces. Great for when you want to see what you're about to operate on before committing.ci( inside function(calculateTotal(items)) changes just the inner parens. Press . to repeat the same change elsewhere.For the full reference, see our Neovim cheatsheet and the motions deep dive.