Vim on Windows: Mapping control sequences to keys in vimrc doesn't work for insert mode
I'm running Vim 7.2 on Windows 7, and I'm having issues mapping control sequences in insert mode.
I can use :inoremap jl <Esc>
while inside vim, and, as expected, typing jl
while in insert mode will cause vim to go to normal mode. However, if I put inoremap jl <Esc>
in my _vimrc, then type jl
inside vim in insert mode, it actually types out <Esc>
, which is not what I wanted. I've tried variations with backslashes and whatnot, but those just get ty开发者_JAVA技巧ped out too.
How can I set up my _vimrc to exit to normal mode when I type jl
in insert or visual mode?
You should either be in nocompatible
mode for <Key>
to work, or explicitely specify <special>
:
inoremap <special> jl <Esc>
or
set nocompatible " At the very top of vimrc, before any other option
<...>
inoremap jl <Esc>
精彩评论