5

I use nnoremap ; : to go to command mode. Is there oposite shortcut that i can add to my .vimrc so that i won't press ESC every time to go back to normal mode?

2 Answers 2

1

Aborting command-line mode shouldn't be so frequent, why do you worry about having to press Esc?!

Some people remap Caps Lock to either Esc or Ctrl (outside of Vim), this also helps with leaving insert mode. Did you know that you can also use Ctrl-C to abort the command-line? Alternatively, you can define a mapping, e.g. ;; to abort the command-line:

:cnoremap ;; <C-c>
0

Choose some easy-to-type key sequence that you aren't likely to use in any text and map it to <Esc>. The sequence qq is not found in English, for example, so you could map it like this:

inoremap qq <Esc>

If you ever have a need to enter that sequence into some file, just precede it with Ctrl-V.

3
  • He wants to leave the command line, not insert mode, but the mapping is almost identical: :cnoremap. Dec 22, 2012 at 2:01
  • @Ingo Karkat: OK, thanks. I never leave command mode except when finishing the command, so despite his words, I assumed he meant to leave insert mode.
    – garyjohn
    Dec 22, 2012 at 5:09
  • Although not relevant answer, you helped me fix my problem with remaping Esc to something more reachable :)
    – Ratul
    Jul 19, 2015 at 20:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .