Inner Word vs A Word

iw and aw โ€” the first text objects.

Keys: iw, aw

Text objects produce a (start, end) range without using the cursor. iw is the word the cursor is in. aw is that word plus surrounding whitespace.

Up to now, the noun in operator+motion has been a motion โ€” a path from where you are to where you'll end up. Text objects change that. They name a chunk of text directly, no path required. The first one to learn is the word.

Delete the word the cursor is on (no spaces)
KeyNote
d
i
w
Delete the word AND the surrounding space
KeyNote
d
a
w
Change just the word
KeyNote
c
i
w
Yank the word and a space
KeyNote
y
a
w
iw vs aw โ€” inner vs around

Reference

Object Range
iw Word (keyword chars only)
aw Word + surrounding whitespace
iW WORD (whitespace boundaries)
aW WORD + surrounding whitespace

Worked example โ€” ciw vs caw

Inner word vs around word.

Step 1 ยท
textobj.iw-aw
Step 2 ยท diw ยท diw โ€” 'quick' gone, parens kept.
diw โ€” 'quick' gone, parens kept.
Step 3 ยท u daw ยท daw โ€” 'quick ' AND its surrounding space gone.
daw โ€” 'quick ' AND its surrounding space gone.

i = inner (just the thing). a = around (thing + its delimiters or trailing space).

โ–ถ Try this in the simulator

See also: The Vim Grammar, Quote Text Objects, Bracket Text Objects, Word Motions