Vim Stuck In Insert Mode

I had mistakenly hit Ctrl + s, and got stuck in the insert mode. To get out of it use Ctrl + q.


Try using Ctrl-[ instead of Esc.

What is the result of:

python -c "print ord(raw_input('char '))"

when you press Esc and Enter? It should be "27". What is the result of pressing Ctrl-V then Esc?

Have you checked all the settings in PuTTY to see if they're reasonable?

Are you using Bash on the remote system? Look at the output of

bind -p | grep -i '\\e' | less

and see if you see anything unusual. Do you have a file called ~/.inputrc? Look at its contents to see if anything is unusual.

Look at your ~/.vimrc and see if everything's OK, too.


Maybe you are using the insert mode.

'insertmode' 'im' 'noinsertmode' 'noim'
boolean (default off)
Makes Vim work in a way that Insert mode is the default mode. Useful if you want to use Vim as a modeless editor. Used for |evim|.
[...]
- Use CTRL-O to execute one Normal mode command |i_CTRL-O|). When this is a mapping, it is executed as if 'insertmode' was off. Normal mode remains active until the mapping is finished. - Use CTRL-L to execute a number of Normal mode commands, then use Esc to get back to Insert mode. Note that CTRL-L moves the cursor left, like does when 'insertmode' isn't set. |i_CTRL-L|

I suggest editing ~/.vimrc to add the following line:

set noinsertmode         "disable insert mode

Tags:

Linux

Vim

Putty