Bracket Text Objects
i( i{ i[ i< โ operate on the contents of any bracket pair.
i( / a( for parens, i{ / a{ for braces, i[ / a[ for square brackets, i< / a< for angle brackets. ib and iB are aliases for parens and braces.
Bracket objects are the most-used text objects in real code. They're how you yank arguments, change function bodies, and delete array literals without ever counting characters.
| Key | Note |
|---|---|
| c | |
| i | |
| ( |
| Key | Note |
|---|---|
| d | |
| a | |
| { |
| Key | Note |
|---|---|
| v | |
| i | |
| [ |
| Key | Note |
|---|---|
| y | |
| i | |
| < |
Reference
| Object | Range |
|---|---|
| i( / ib | Inside ( โฆ ) |
| a( / ab | Including ( โฆ ) |
| i{ / iB | Inside { โฆ } |
| a{ / aB | Including { โฆ } |
| i[ / a[ | Inside / including [ โฆ ] |
| i< / a< | Inside / including < โฆ > |
Worked example โ di( vs da(
Brackets work like quotes.
[missing screenshot textobj.brackets/frame_01.color.svg โ run python content/render_screenshots.py]
[missing screenshot textobj.brackets/frame_02.color.svg โ run python content/render_screenshots.py]
[missing screenshot textobj.brackets/frame_03.color.svg โ run python content/render_screenshots.py]
See also: Quote Text Objects, Match Bracket, The Vim Grammar