My goal is to enhance the usage of gv with counts, in order to access older selections quickly. Such that 2gv would reselect the selection made before the last.

Vim doesn't have events for entering visual mode, so could it be possible to store them through the >< marks?

  • I dont't quite understand the question: yes, it's possible to store marks / mode and later to re-enter the same selection; no, there's no 100% reliable way to track all transitions (you can map v/V/^V but it's not enough to cover all cases) as there's no such event (and you see it yourself). You'd probably have more success in submitting issue/PR to Vim's github directly (either new event(s) or even new transition stack similar to :jumps and :changes). – Matt May 10 at 6:49
  • Yeah there doesn't seem to be any easy way to access the mechanics of gv with vimscript. Do you know if there's a way at least to track when marks change? Combined with mode() it could be a start. – M.V. May 10 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.