Cheatsheet Pages / Vim Cheatsheet

How to edit with Vim text objects — ciw, ci", dap, di(

You want to change the thing under the cursor — a word, a quoted string, a paragraph, a bracket block — as one unit.

Almost every entry was run headless in Vim 9.1 and the resulting file checked; the few entries a tiny build cannot run (system clipboard, persistent undo, the sudo save) were verified against Vim's own documentation instead.

ciw         " change inner word — the whole word, wherever the cursor sits in it
ci"         " change inside the quotes — replaces the quoted text, keeps the quotes
di(         " delete inside the parentheses — leaves func() standing
dap         " delete a paragraph (the paragraph AND its trailing blank line)

Good to know

i = inner (contents only), a = a/around (contents plus the quotes, brackets or blank line).

Vim Cheatsheet one-page card — commands that actually work
The full one-page card — Vim Cheatsheet. Get the complete cheatsheet on GitHub