vim does not map customized key?

it is a long time confusing me that why my customized key map in vim does not work? Some vim configuration contents in "/etc/vimrc" are as the following:

"在insert mode下也可以 快速移动到行尾和行首"
imap <c-l> <esc>A
inoremap jj <esc>ji
inoremap kk <esc>ki
inoremap hh <esc>ha

After experiencing many times, i suddenly/brusquely recognize that this issue may be caused by the compatibility between vi and vim. In vi mode, everything such as "<", ">", has no special meanings. Therefore, a map like "imap c-l e scA", "e sc" will be interpreted to their original and literal charater expression. That is to say, "e sc" will be displayed "e sc" and not be translated into a "normal mode" command.

And, vim program starts in vi compatible mode by default.

So, make sure to set "no compatible" command and keep it before any key map commands.

上一篇:Web应用安全十大主动安全措施


下一篇:C#高级编程笔记 Day 7, 2016年9月 19日 (泛型)