Vim imap jk <Esc> not working

linux, vim

Solution

It looks like your `'cpoptions'` settings contains `<`; then, special key codes like `<Esc>` are not recognized.

Find out where this got set via

:verbose set cpo?

or re-write the mapping to use a literal Escape character; enter it via Ctrl + V Esc; it should appear as `^[` in the buffer.

PS: Though not related, you should usually use `:inoremap` unless remapping is required.

Problem

In my vimrc, I've remapped jk to escape using imap. The problem emerges when I use jk; it doesn't escape, it only echoes out `<Esc>`. Here's the entry in quiestion: `imap jk <Esc>` It's also a good point to make that I'm also using vim-X11 in fedora.

Original source