First in a series of occasional vim tips, as and when I feel like them.

We’re used to moving around by words, paragraphs and lines, but when grabbing selections or making changes, these can be inefficient. Whole blocks can be grabbed using the “a” and “i” verbs.

[action]a[object] – Do something to the whole object, including its boundary.

Examples:

caw – Change a Word

ca( – Change the contents of a set of brackets, including the brackets.

ya{ – Yank an entire method

[action]i[object] – Do something to the object, excluding its boundaries.

Examples:

ci( – Change the contents of a set of brackets, leaving the brackets.

yi” – Copy between a pair of quotation marks.

di{ – This method sucks, delete everything between the curly brackets.