Open sauterp opened 3 years ago
I've seen this as well but learned to live with it. It'd be nice to get the same (primary) completion on every selection though.
The Vis:insert function inserts keys at all cursor positions of active window. I copied few lines from digraph.lua and it is working with multiple selections and also in replace mode.
Just replace this line with that:
if vis.mode == vis.modes.INSERT then
vis:insert(out)
elseif vis.mode == vis.modes.REPLACE then
vis:replace(out)
end
PS: This only works when the prefixes of all selections are the same
The Vis:insert function inserts keys at all cursor positions of active window. I copied few lines from digrpah.lua and it is working with multiple selections and also in replace mode.
Just replace this line with that:
if vis.mode == vis.modes.INSERT then vis:insert(out) elseif vis.mode == vis.modes.REPLACE then vis:replace(out) end
PS: This only works when the prefixes of all selections are the same
Thank you for the hint, I extended on this in my PR. It will only autocomplete those selections which share the same prefix as the primary selection, the others remain unchanged.
I'm not sure if this is a good solution for everyone, but it would work for me.
Version commit: 1a958f221404b09cb8b0612fb34301e6b9783cf9 (latest master at this time)
vis -v vis v0.7-29-g1a958f2 +curses +lua +acl
How to reproduce
Only the primary selection will be completed. It's not a big problem, but I would find it more convenient and consistent with other features if the autocompletion would apply to all selections, like pasting. Unlike pasting, I wouldn't have a different autocomplete suggestion for each selection. That's not feasible I think. I would implement it such that the suggestions are generated based on the primary selections cursor. What do you think?