Table of Contents
Neovim Operators and Motions
The operator-motion paradigm is central to Vim/Neovim efficiency. An operator is a verb (what to do), and a motion is the subject (where to do it). Combine them: operator + motion = command.
Operators
d — delete, y — yank (copy), c — change (delete and insert), v — visual (select), > — indent right, < — indent left.
Each operator can be doubled to act on the line: dd, yy, cc, >>, <<.
Operators also work with text objects:
dw " delete word y2e " yank to end of next word c3j " change next 3 lines >ip " indent paragraph
Text objects
Text objects describe structural chunks of text, independent of cursor position. They work with operators.
Motions: w (word), s (sentence), p (paragraph).
Brackets: (), [], {}, <> — jump to or select between them. di( deletes inside parens. da( deletes including parens (delete-around).
Pairs: i' (inside quotes), a' (including quotes), i", a", i` , a` .
Inside vs around: i for inside (not including delimiters), a for around (including delimiters).
di( " delete inside parens ca"new" " change "string" → new" yip " yank inside paragraph dit " delete inside tags
Useful combinations
d2w — delete 2 words. y$ — yank to end of line. c0 — change from start of line.
di{ — delete contents of braces (useful in code). c2i) — change twice-nested parens.
>5j — indent next 5 lines. < for un-indent.
Visual mode + operators: select text with v, then press operator. Often simpler for complex selections.
" Common patterns ci"hello" " change inside quotes → hello" d3w " delete 3 words >G " indent rest of file yt; " yank until semicolon
Counts: prefix with numbers. 5dd or d5d both delete 5 lines. Works with motions: 5w moves 5 words, d5w deletes 5 words.
Marks: :mark a (or ma) sets mark, ` a jumps to mark. Marks are persistent (:marks lists them).
