How to switch between command and insert modes in Vim?

I just started using Vim as an IDE. I used it as a test editor for a while, so I didn't have to switch to command mode often. But, since I program in Java, I need to go into command mode to make a file, compile / run it ... etc.

The problem is this: I need a good way to switch between the two modes.

I looked online and he says that the <Esc> should do this, but that doesnโ€™t work for me (maybe this is not for gVim? I donโ€™t know why.)

I need to press CTRL O each time to enter command mode; the exit key works from this mode ... it brings me back to insert mode. But is there a better or easier way to switch between command mode and insert mode?

+56
vim command insert
Nov 01
source share
5 answers

It looks like your Vim is starting up in a convenient mode. See :help easy .

This happens when Vim is called with the -y argument or as evim , or perhaps you have :set insertmode somewhere in your .vimrc configuration. Find the source and turn it off; temporarily, this can also be done with Ctrl + O :set noim Enter .

+34
Nov 01
source share

Pressing ESC terminates in insert mode to normal mode, where you can press : to enter a command. Press i again to return to insert mode, and you're good to go.

I am not a vim guru, so someone else might be more experienced and give you other options.

+69
Nov 01
source share

This was mentioned in other questions , but ctrl + [is equivalent to ESC on all keyboards.

+6
Mar 29 '16 at 2:53 on
source share

[Using jj] In my case, setting .vimrc (or Gvim is_vimrc) below;

 inoremap jj <Esc> """ jj key is <Esc> setting 
+4
Feb 04 '14 at 7:45
source share

There is also another solution for this kind of problem, which, in my opinion, is quite rare, and you can experience it if you use vim for OS X Sierra. This is actually a problem with the Esc button - not with vim. For example, I was not able to exit the full-screen video on YouTube using Esc, but I lived with this for several months until I ran into the same problem with vim.

I found this solution. If you are lazy enough to follow an external link, disable Siri and kill the process in Activity Monitor.

0
Feb 14 '17 at 14:12
source share



All Articles