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.

原文地址:https://www.cnblogs.com/bkylee/p/5863482.html