The "(insert) VISUAL
" mode can be entered by CTRL+O , v starting from insert mode. This enters visual mode, but is displayed as "(insert) VISUAL
" from within vim, and pressing Esc from this mode brings you back to insert mode, not normal mode. The "(insert) VISUAL
" mode is also entered by shifted arrowed keys from insert mode.
Two related questions:
There does not seem to be much documentation on this special mode. Is there an easy way to search for information about it? (edit: I'm aware of what CTRL+O normally does. The interaction with visual mode seems to be special. The first paragraph was the easiest way to refer to what this mode is in the first place, as I don't know of a searchable name for it.)
How do you write vmap
mappings reliably? Namely, is there a consistent way to leave visual mode and end up in, say normal mode? Or consistently end up in insert mode?
To get into the Vim Visual Line mode, press “Shift+V” while you are in Vim's Normal mode.
Visual mode is a mode in which the Vim (not Vi) editor allows you to select text, either by character, by line, or by block (you may then perform various actions on the selected text). Pressing Esc would exit this mode and return you command/normal mode.
In Vim, there are three modes of operation: Normal, Insert, and Visual.
In insert mode, <C-o>
allows you to execute normal mode commands without leaving insert mode. Vim tries to indicate the new state with (insert)
. Since you are now temporally in normal mode, hitting v
puts you in visual mode and Vim tries, again, to indicate the new state with (insert) VISUAL
. Vim is in this state only because of the sequence of commands you performed and, as pointed out by others, that behavior is documented. At this point, it is normal and expected that <Esc>
puts you back in insert mode since that's your original mode.
Someone with a deeper Vim understanding than me may be able to tell you if there's a reliable way to end up in normal
from insert
-> (normal)
-> visual
but I'd say that the whole idea sounds fishy to me.
Proper usage is:
Basically, you are not supposed to be further than one <Esc>
away from normal mode.
I can't imagine a scenario where using v
after <C-o>
makes any sense.
The best and preferred way to use Vim is to stay out of insert mode as much as possible. Using <C-o>
to avoid leaving insert mode is a very poor strategy. I have no idea if that's what you do but, if you do it, you should reconsider that approach as soon as possible.
But I suspect you are trying to do something else which you, somehow, didn't think we needed to know.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With