I was trying to map key jk to Esc key in Vim.

I didn't know about .vimrc at first. So I pasted these commands in vim in command mode as:

:inoremap jk <Esc>

:cnoremap jk <Esc>

Then obviously it didn't work. So I found out about .virmc so i pasted above commands in ~/.vimrc file and restarted the terminal. Now everytime i press jk, it just pastes this <Esc> word in the file itself.

When i search for :inoremap jk in command mode in vim, it says it is mapped to <Esc>. So if I try to remove it by iunmap jk, it removes it but after terminal restarts, it is back to the same problem. I don't want the keybind jk to paste <Esc> in file but want it to take me to command mode from insert mode. What am I doing wrong here? Any suggestion would help.

1 Answer 1


Turns out i was in confusion with vi and vim.

inoremap and cnoremap helps in mapping key to our specific key binding. I was having problem with vi because vim is superset of vi and this mapping doesn't seem to work in vi.

To remove inoremap and cnoremap we can do:

iunmap <keybinding>

cunmap <keybinding>

  • Just as a side note, it is highly likely that "vi" is just a stripped-down version of Vim on your system.
    – Heptite
    Aug 29, 2021 at 17:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .