O'Reilly logo

Mastering Vim by Ruslan Osipov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Utilizing text objects

Text objects are an additional type of object in Vim. Text objects allow you to manipulate text within parentheses or quotes, which becomes really useful when working with code. Text objects are only available when combined with other operators like change or delete or a visual mode (see Visual and Select Modes in Chapter 3Follow the Leader – Plugin Management).

Let's give it a shot. Navigate your cursor to the text between parentheses:

Now, type in di) (delete inside parentheses). This will delete the text inside parentheses:

This works similarly with a change command. Undo the previous change (u) and start in the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required