我的 .vimrc 中有以下映射,用于映射控制键 + 1、2、3.. 用于切换选项卡。我在 ubuntu 11.10 中使用 gnome 终端,控制键映射似乎不起作用。谁能告诉我我做错了什么。
VIM - Vi 改进版 7.3.154
map <C-S-]> gt
map <C-S-[> gT
map <C-1> 1gt
map <C-2> 2gt
map <C-3> 3gt
map <C-4> 4gt
map <C-5> 5gt
map <C-6> 6gt
map <C-7> 7gt
map <C-8> 8gt
map <C-9> 9gt
map <C-0> :tablast<CR>
syntax on
set shiftwidth=2
First ensure that your terminal emulator (Gnome Terminal) doesn't swallow the key combinations for its own functionality; by default Ctrl + number switches tabs. But I'm afraid you still won't be able to use all those combinations...
Due to the way that the keyboard input is handled internally, this unfortunately isn't generally possible today. Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) In insert or command-line mode, try typing the key combination. If nothing happens / is inserted, you cannot use that key combination. This also applies to <Tab>
/ <C-I>
, <CR>
/ <C-M>
/ <Esc>
/ <C-[>
etc. (Only exception is <BS>
/ <C-H>
.) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.
有些人(首先是 Paul LeoNerd Evans)想要解决这个问题(即使是支持此功能的终端中的控制台 Vim),并且已经浮动各种建议 http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8.
但截至今天,还没有补丁或志愿者主动提出,尽管许多人表示希望在未来的 Vim 8 主要版本中提供此功能。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)