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 didnt 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 couldnt I get out of it?
I was totally not aware of this Ex mode, then I remembered skimming over Actually using ed and thats the time I realized that this is Ex mode, which I didnt 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 its 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.