vim-textobj-user
vim-textobj-user copied to clipboard
Support empty text objects
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...)