In Vim, Ex mode can and only be entered from Normal mode by Q key.
I accidentally stumbled into Ex mode when I pasted some text incorrectly which somehow trigged the mode switching. Because there was a lot of text, errors, I didn’t catch the return command from the message:
Entering Ex mode. Type "visual" to go to Normal mode.
Quite funny, I was like “What the heck is with :? Why am I being stuck in it? Why couldn’t I get out of it?”
I was totally not aware of this “Ex” mode, then I remembered skimming over Actually using ed and that’s the time I realized that this is Ex mode, which I didn’t know Vim has it built in. Then I read Vim 101: ed and ex told me the :visual, I finally got myself out.
1 Entering Ex mode
There are three ways:
- Run vim with -e option,
- Type Q, or g then Q in Vim, or
- Run ex command, on my computer it’s a symbolic link to Vim binary.
If you use gQ to enter “Ex” mode, then some functions like completion or inserting contents of named registers, for instance, Ctrl+R, /, can still be used .
Strangely, I can not find any other way like a Vim command to switch. You must use Q key when inside Vim.
2 Leaving Ex mode
- Enter visual or vi to switch back to Normal mode.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.