johnsimer
johnsimer

Reputation: 350

.vimrc remap jj <ESC> not working - taken literally

in my .vimrc I have the following imap jj <ESC>

When I type jj however while in insert mode, instead of exiting insert mode VIM literally types <ESC> into my document. Hitting the escape button does take me from insert to command mode, as expected.

How do I remap jj to allow me to exit insert mode?

I am using vim 7.4 on Ubuntu 16.04

Upvotes: 2

Views: 1272

Answers (2)

Max Heiber
Max Heiber

Reputation: 15582

:set nocompatible worked for me. I think vi-compatibility mode may have been the problem.

Upvotes: 1

Ingo Karkat
Ingo Karkat

Reputation: 172768

:help key-notation has this to say:

If you want to use the full <> notation in Vim, you have to make sure the '<' flag is excluded from 'cpoptions' (when 'compatible' is not set, it already is by default).

:set cpo-=<

This might have been accidentally set in your Vim session, and after a Vim restart the problem went away.

Upvotes: 4

Related Questions