I just installed Ubuntu 12.04 on a new computer and apt-get install[ed] vim
and I'm having some weird behavior with my aliased Esc – if I'm in INSERT
mode and I type the Esc key, I exit INSERT
mode and the cursor moves one character to the left, as expected, but if I type the jk
alias, which I have defined in my .vimrc
as inoremap jk <Esc>
, I exit INSERT
mode and the cursor moves one character to the right, which is actually quite disconcerting. Any ideas as to why this is the case?
Ubuntu – Difference in behavior of `` and `inoremap jk ` in vim
Ubuntuvim
Best Answer
I don't think this is because of this rule alone, something else is causing this. If I create a
.vimrc
file with just this rule in it:I get the same behavior as expected from both methods.
Example #1 - esc
Invoke
vim
, go into Insert mode, right arrow 1 time, hit Esc.Example #2 - jk
Invoke
vim
, go into Insert mode, right arrow 1 time, hit jk.