To disable "Entering Ex mode" in Vim

VimEx Mode

Vim Problem Overview


I get the following 10X times a day by accident.

> Entering Ex mode. Type "visual" to go to Normal mode.

How can you disable the combo which causes it in Vim?

Vim Solutions


Solution 1 - Vim

<Nop> is meant for use in mapping keys to "nothing". See :h <Nop>.

:map Q <Nop>

Or put it in your ~/.vimrc:

map Q <Nop>

.

Solution 2 - Vim

This answer is based on @NielsBom's comment 4. October 2012 and on @BrianCarper's answer 13. August 2009.

I think NielsBom is completely right, please see the article. The command map is really evil in Vim and has caused me a lot of problems during years. I did not realize the thing before NielsBom's comment. So please use the following command instead:

:nnoremap Q <Nop>

Solution 3 - Vim

The "combo" is Q. To disable it, simply map Q to something else:

:map Q <whatever>

I use gq, which is used to format text.

If you don't want it do do anything map it to <Nop>:

:map Q <Nop>

Solution 4 - Vim

If you don't want to map it to something else, just use :unmap. If you do have something else in mind, :map will work - take a look at the help pages to see the variations to specify what modes the map will be used in.

Solution 5 - Vim

Another, albeit slightly more extreme option, would be to switch to https://neovim.io, which has removed ex-mode entirely, due to no one ever actually using it for anything ever.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionL&#233;o L&#233;opold Hertz 준영View Question on Stackoverflow
Solution 1 - VimBrian CarperView Answer on Stackoverflow
Solution 2 - VimLéo Léopold Hertz 준영View Answer on Stackoverflow
Solution 3 - VimR. Martinho FernandesView Answer on Stackoverflow
Solution 4 - VimCascabelView Answer on Stackoverflow
Solution 5 - VimmaniacalrobotView Answer on Stackoverflow