The Grammar Matrix
Every operator ร every text object = the table that makes Vim click.
A reference matrix showing operators (rows) ร text objects/motions (columns). Use it to think 'operator first, motion second' instead of memorizing combinations.
Vim's productivity comes from a tiny grammar: pick an operator, then pick a text object or motion. The two combine into NรM commands without you having to memorize each one.
Operators (the verbs)
| Op | Action |
|---|---|
| d | Delete (cut to register) |
| c | Change (delete + Insert) |
| y | Yank (copy to register) |
| >, < | Indent / outdent |
| = | Reindent (per 'indentexpr') |
| gU, gu, g~ | Upper / lower / toggle case |
| gq | Reformat (line-wrap) |
| ! | Filter through shell command |
| g? | ROT13 |
Text objects (the nouns)
| Object | Selects |
|---|---|
| iw / aw | Inner / a word |
| iW / aW | Inner / a WORD |
| is / as | Inner / a sentence |
| ip / ap | Inner / a paragraph |
| it / at | Inner / a tag (HTML/XML) |
| i" / a" | Inner / a double-quoted string |
| i' / a' | Inner / a single-quoted string |
| i` / a` | Inner / a backtick string |
| i( / a( | Inner / a parenthesized region (also ib) |
| i[ / a[ | Inner / a bracketed region |
| i{ / a{ | Inner / a brace block (also iB) |
| i< / a< | Inner / an angle-bracket region |
Motions (also act as ranges)
| Motion | Range |
|---|---|
| w, b, e | Next/prev word boundary |
| 0, ^, $ | Line endpoints |
| f{c}, t{c} | To/till char on line |
| % | Match bracket |
| G, gg | Last / first line |
| nG | Line n |
| H, M, L | Top/middle/bottom of viewport |
| /pat, ?pat | Search forward/back |
| gn | Next search match (text-object-like) |
| `{m} | To mark m |
See also: The Vim Grammar