Tip 51: Trace Your Selection with Precision Text Objects
Return to the top: <<Practical Vim>>
References
# If you open the file in vim, # then you can \"ayy@a the next line to execute the vim command: :h text-objects
-
text objects prefixed with
i(inside): select inside the delimiters -
text objects prefixed with
a(around/all): select everything including the delimiters
| Text Object | Selection |
a) or ab
|
A pair of (parentheses) |
i) or ib
|
Inside of (parentheses) |
a} or aB
|
A pair of {braces} |
i} or iB
|
Inside of {braces} |
a]/a[
|
A pair of [brackets] |
i]/i[
|
Inside of [brackets] |
a>/a<
|
A pair of <angle brackets> |
i>/i<
|
Inside of <angle brackets> |
a'
|
A pair of 'single quotes' |
i'
|
Inside of 'single quotes' |
a"
|
A pair of "double quotes" |
i"
|
Inside of "double quotes" |
| a` |
A pair of backticks
|
| i` |
Inside of backticks
|
at
|
A pair of <xml>tags</xml> |
it
|
Inside of <xml>tags</xml> |
Performing Operations with Text Objects
As a mnemonic:
-
ci": change inside the double quotes -
cit: change inside the tag