[英]Vim key mapping works in command editor, not in .vimrc - why?
当我通过命令缓冲区创建以下键映射时,它按预期方式工作,将光标向下移动了5行:
map ^[[1;3B 5<Down>
当我将其添加到我的.vimrc文件中以便跨会话使用时,按Alt + Down可向后移动1行(移至垂直上方的某处-可能会转到上一个句子)。 我的:map输出是这样的:
0 ^
^[[1;3B 5<Down>
n gx <Plug>NetrwBrowseX
n <Plug>NetrwBrowseX * :call netrw#NetrwBrowseX(expand("<cWORD>"),0)<CR>
Press ENTER or type command to continue
为什么此vimrc映射不能像我在命令缓冲区中键入的那样工作?
我的vim版本是:
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 10 2014 00:22:49)
Included patches: 1-135
Compiled by <cygwin@cygwin.com>
UPDATE
有2个问题。
map <M-Down> 5<Down>
但确实了解map <M-Down> 5j
map <M-Down> 5j
无法正常工作。 为了在Cygwin环境中获得“正常”的vim行为,我不得不采取一系列措施: "================== " Keyboard trouble "================= " Every so often I am using a system that inserts a A, B, C, or D " when using the arrow keys within the Vim editors insert mode. " Vim is for VI Improved. While I did not dig into the exact reasons " as to why (terminal emulation?) it happens, it is quite annoying. set nocompatible "set term=cons25 " This fixes Cygwin's vim's page up, home, end etc. keys " http://superuser.com/questions/480215/ " how-to-map-pagedown-and-pageup-keys-to-function-normally set term=mintty set backspace=2 " backspace on Cygwin Windows Objy was not deleting properly. " But this doesn't solve other cursor movements like "home and end "source /home/sarnobat/.vim/cscope_maps.vim "g:CCTreeCscopeDb = "/home/sarnobat/cscope/cscope.files" "============================== " Key bindings "============================== map 0 ^
您可以尝试以下操作:
map <M-down> 5j
在cygwin上进行了尝试,并且有效。 hjkl是向左,向下,向上和向右导航的首选方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.