solution to vim arrow key mapping problem.
在使用 vim 的插入模式(Insert mode)時候,按方向鍵(arrow key) ,卻出現 A B C D,游標(cursor)沒有正常的移動?多半是因為 TERM 環境變數設定的問題。今天在網路上找到了一個解法,直接在 .vimrc 中設定方向鍵的 mapping. 參考的文件是這裡
文章原文如下:
This doesn't really work very well for me on SunOS -- I have the same problem but :set term=cons25 just gives me OC everywhere before each character until I redraw. Weird.
But, :set term=ansi works great, and the arrow keys work.
A better solution is to, while in vi, type in insert mode [ctrl-v][arrow up] and see what you get.
Then, in your .vimrc, add the lines
set t_ku=[ctrl-v][esc]OA # or whatever you saw
so it ends up looking something like
set t_ku=^[OA
set t_kd=^[OB
set t_kr=^[OC
set t_kl=^[OD
(though you want REAL escape chars instead of ^[.)
Note: Please edit in vi editor.
(http://gdfan.twbbs.org/blog/2005/09/21/328)
http://www.vim.org/tips/tip.php?tip_id=550
No comments:
Post a Comment