[英]Mapping <C-left> and <S-left> in Vim
I've been trying to get Vim to behave a little more like ACE to no avail. 我一直试图让Vim表现得像ACE一样无济于事。
In particular, I've been trying to get Vim to accept CTRL + LEFT in insert
mode as a mapping for ESC, v, B , and SHIFT + LEFT in visual
mode as a mapping for B , for example: 特别是,我一直试图让Vim在insert
模式下接受CTRL + LEFT作为visual
模式下ESC,v,B和SHIFT + LEFT的映射,作为B的映射,例如:
" in my ~/.vimrc:
inoremap <C-LEFT> <ESC> v B
vnoremap <S-LEFT> B
But these bindings seem to fail. 但这些绑定似乎失败了。 To be clear, I get an error that says 要清楚,我得到一个错误
E388: Couldn't find definition
when I try the CTRL + LEFT mapping: 当我尝试CTRL + LEFT映射时:
What am I doing wrong? 我究竟做错了什么?
You need to drop the spaces between the individual keys; 你需要删除各个键之间的空格; whitespace only separates the left-hand side from the right-hand side: 空格只分隔左侧和右侧:
:inoremap <C-LEFT> <ESC>vB
<Space>
in normal mode is a command that moves the cursor to the right; 正常模式下的<Space>
是将光标向右移动的命令; that would interfere with the mapping. 这将干扰映射。
You need to check that no other configuration / plugin remaps your left-hand side later: 您需要检查以后没有其他配置/插件重新映射左侧:
:verbose imap <C-LEFT>
:verbose vmap <S-LEFT>
Also note that inside the terminal, combinations of modifier keys (like Shift and Ctrl ) and other keys may not work; 另请注意,在终端内部,修改键(如Shift和Ctrl )和其他键的组合可能不起作用; this shouldn't be a problem in GVIM, though. 不过,这在GVIM中应该不是问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.