I'm working on a plugin and I use visual selections all the time in my code. Stuff like normal! v{:call whatever()\<cr>
.
The problem is that if the user does gv
in his file it won't select his last visual selection, but the last visual selection used by my plugin.
So is there any way I can prevent that from happening?
gv
uses the marks<
and>
. Presumably you could save them away and restore them in your code, but I'm not sure how you would do that without actually visiting the location'<
and saving that location to a different mark....>
and<
marks usinggetpos()
/setpos()
. I do that for the NrrwRgn plugin. This needs patch 7.3.590v{:command
could be expressed with.,'}command
. Maybe you could use visual mode a little less.