An history for gv (visual selection)
gv is a great shortcut. Allows to re select the last visual selection.
Recently, I've been working from nvim with repl in jupyter style extensively, and I started to miss circling back in selection history.
(Very happy with yarepl, shout out to the author)
Did not find anything useful on the topic, so wrote this small plugin.
With lazy.nvim :
return {
"Yinameah/nvim-gvhist",
opts = {
-- Max number of selection to remember
-- This is a per window number
hist_max = 100,
-- If set to false, no mapping will be set.
default_mapping = true,
},
},The plugin provides only two functions :
require("gvhist").sel_prev()require("gvhist").sel_next()
By default, they are mapped to <c-p> & <c-n> in visual mode only, but you can disable this and map it the way you like.
Note that the two functions works from normal mode as well, so one can basically remap gv to sel_prev().
The selection history is per window, but nothing special is done when the buffer is modified, which means the selection history will end up all over the place.
GvhistClear user command is provided to delete the history in case of need.
