Vim Stuck In Insert Mode

I've been using Vim for several months now via my web host (they allow putty access). All of a sudden, the escape key has become unresponsive. I cannot exist insert or any other mode by simply hitting escape. I have to hit F1 which brings up the help in vim and kicks me into command mode.

I'm most certain that my escape key on my keyboard is functioning fine since all of my windows shortcuts that use the escape key operate normally.

I know this is a ridiculous question and I'm certain there's a lot more to look into regarding a solution. What I really need is a solid lead as to where to start looking.

Things that might help:

  1. I'm using vim via putty
  2. I'm logging in using jailshell
  3. I'm not root

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.


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


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