Reputation: 1079
I just started using Vim as an IDE. I was using it as a test editor for a while now, so I didn't have to go to command mode very often. But, since I program in Java, I have to go to command mode to make the file, compile/run it... etc.
The problem is: I need a good way to switch between the two modes.
I looked online and it says that the <Esc>
key is supposed to do that, but that doesn't work for me (maybe it's not for gVim? I don't know why.)
I have to press CTRLO every time to go to command mode; the escape key works from that mode... it brings me back to insert mode. But is there a better, or easier, way of switching between command mode and insert mode?
Upvotes: 106
Views: 281745
Reputation: 3752
For me, the problem was that I was in recording mode. To exit from recording mode press q. Then Esc worked as expected for me.
Upvotes: 5
Reputation: 145
Using jj
In my case, the .vimrc (or in gVim it is in _vimrc
) setting below.
inoremap jj <Esc> """ jj key is <Esc> setting
Upvotes: 7
Reputation: 16468
Pressing ESC quits from insert mode to normal mode, where you can press : to type in a command. Press i again to back to insert mode, and you are good to go.
I'm not a Vim guru, so someone else can be more experienced and give you other options.
Upvotes: 127
Reputation: 369
Coming from emacs I've found that I like ctrl +
keys to do stuff, and in vim I've found that both [ctrl + C]
and [alt + backspace]
will enter Normal mode from insert mode. You might try and see if any of those works out for you.
Upvotes: 6
Reputation: 1
There is also one more solution for that kind of problem, which is rather rare, I think, and you may experience it, if you are using vim on OS X Sierra. Actually, it's a problem with Esc button — not with vim. For example, I wasnt able to exit fullscreen video on youtube using Esc, but I lived with that for a few months until I had experienced the same problem with vim.
I found this solution. If you are lazy enough to follow external link, switching off Siri and killing the process in Activity Monitor helped.
Upvotes: 0
Reputation: 471
This has been mentioned in other questions, but ctrl + [ is an equivalent to ESC on all keyboards.
Upvotes: 37
Reputation: 172768
Looks like your Vim is launched in easy mode. See :help easy
.
This happens when Vim is invoked with the -y
argument or as evim
, or maybe you have a :set insertmode
somewhere in your .vimrc
configuration. Find the source and disable it; temporarily this can be also done via Ctrl + O :set noim
Enter.
Upvotes: 60