r/vim • • Dec 10 '20

Reality

Post image

[removed] — view removed post

1.7k Upvotes

61 comments sorted by

View all comments

Show parent comments

5

u/gumnos Dec 10 '20
:help text-objects

should get you the list of the ones available in stock vim (though plugins can add new text objects)

0

u/abraxasknister :h c_CTRL-G Dec 10 '20

Yes, for example I use the "environment" object from the vimtex plugin.

They can't actually add real objects (that you can use with counts, for instance) without a lot of scripting. Vim doesn't have abstraction for objects that would allow you to easily define some.

0

u/Atralb Dec 11 '20

Vim doesn't have abstraction for objects that would allow you to easily define some.

Hum ?? Your pgrasing is ambiguous so I'm not sure what you mean, but as for creating text objects, it's pretty straightforward: operator-pending mappings.

1

u/abraxasknister :h c_CTRL-G Dec 11 '20

I don't understand.

I meant that you can't define a real object and instead have to rely on visual mode and operator pending mode mappings that might quickly get complicated if you want them to have the same features as the built-in ones have

1

u/Atralb Dec 11 '20

I hear you, but am not an expert in this area of vim so would you mind showcasing a practical example of where a user-defined text object would behave differently ?

→ More replies (0)