vim-textobj-user icon indicating copy to clipboard operation
vim-textobj-user copied to clipboard

Support empty text objects

Open alberto-lazari opened this issue 2 years ago • 0 comments

When defining text objects with regex it is not possible to match an empty inner object.

Example

I define a custom math text object for LaTeX $x$.
If I type ci$ I end having $$, so far so good, but if I want to get into the object, and type ci$ again I would expect nothing to change and the cursor to place into $$, just like it works for () [] {} and other native stuff.

This is probably a limitation of Vim's regexes. I think that you can define dedicated function for all the possible movements, but that would be a real hassle (like, define di$ to first check if it is empty, then do other stuff. Repeat for di$, yi$, vi$, etc...)

alberto-lazari avatar Jul 17 '23 09:07 alberto-lazari