In vim, when I operate on a textobject from a plugin, say the 'inner indent' typed
ii from kana/vim-textobj-indent, my last visual selection (
'<) is reset to where the operator worked on. That is usually quite useless.
However, this is not the case with built-in textobjects like
is (inner sentence),
ap (a paragraph), etc.
Since the 'last visual selection' is a useful thing to keep i.m.o., and there already are markers for 'last operator-pending opfunc range' (
']), is there a way to achieve consistency in this behavior, to keep the visual range markers untouched by ranges or movements that were used by operators?
Notes on the intended scope of the question:
- I am aware of the 'usual way' of implementing a textobject:
omap :<C-u>exec "normal! <do-something-with-visual-selection-here>". Every textobject in existence seems to base on
kana/vim-textobj-user. Could a possibility lie in changing how that library implements textobjects? One could maintain a forked version of that plugin.
- Not-quite-that-big workarounds would be preferred, however :)
Thank you for your insights!