1

If I enter visual mode, select some text, then run a command or press a keybinding, it will exit visual mode afterward because it assumes I am done.

But sometimes I want to do multiple things with that visual selection.

How can I make Vim stay in visual mode unless I explicitly exit by pressing Escape?

2

1 Answer 1

3

There is no in built vim option to leave it selected.

However but there is a way to reselect quickly

If it's indent related then these mappings might be useful

local map = vim.api.nvim_set_keymap
map('v', '<', '<gv', (noremap=true, silent=true))
map('v', '>', '>gv', (noremap=true, silent=true))
2
  • 1
    Same answer was given here: stackoverflow.com/a/4711096/11135136. (It also has a slightly better approach (using .) for indenting usage.)
    – 3N4N
    Commented Sep 24, 2022 at 5:48
  • Thanks, I will fork Neovim and submit a pull request for an option to keep visual mode selected.
    – Amarakon
    Commented Sep 24, 2022 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.