1

In my environment, invoking :normal in visual mode does visual mode command.

" A map for calling command without quitting visual mode
" It gets the cursor to the other side of selection
vnoremap s <Cmd>normal o<CR>

I think this is a helpful feature if this is officially intended, but I'm afraid it's not and my plugins using this behavior doesn't work in other environments because :h :normal says

Executes Normal mode commands

Is it properly working when :normal does visual mode command, and is that common to all environments?

1 Answer 1

1

Actually, "normal" executes a sequence of keys. The point is that "cmd" (unlike "colon") suppresses mode switching and so it starts executing the sequence while still in Visual mode.

But you don't need "normal" here at all. To access Visual mode keys simply map to these keys directly; also, use "esc" and "gv" to return to Normal and to restart Visual respectively.

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.