简体   繁体   English

.vimrc映射控件密钥不起作用

[英].vimrc mapping for control key not working

I have the below mapping in my .vimrc for mapping control key + 1, 2, 3.. for switching tabs. 我在.vimrc中有以下映射,用于映射控制键+ 1,2,3 ..用于切换选项卡。 I am using gnome terminal in ubuntu 11.10, the control key mappings does not seem to work. 我在ubuntu 11.10中使用gnome终端,控制键映射似乎不起作用。 could any one tell what I am doing wrong. 任何人都可以告诉我做错了什么。

VIM - Vi IMproved version 7.3.154 VIM - Vi IMproved版本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; 首先确保您的终端仿真器( Gnome终端 )不会吞下用于其自身功能的组合键; by default Ctrl + number switches tabs. 默认情况下, Ctrl +数字切换选项卡。 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. 某些键组合(如Ctrl +非字母)无法映射,而Ctrl +字母与Ctrl + Shift +字母无法区分。 (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. (除非您的终端为其发送不同的termcap代码,但大多数情况下都没有。)在插入或命令行模式下,尝试键入组合键。 If nothing happens / is inserted, you cannot use that key combination. 如果没有任何反应/插入,则无法使用该组合键。 This also applies to <Tab> / <CI> , <CR> / <CM> / <Esc> / <C-[> etc. (Only exception is <BS> / <CH> .) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel. 这也适用于<Tab> / <CI><CR> / <CM> / <Esc> / <C-[>等(只有例外是<BS> / <CH> 。)这是一个众所周知的痛点,以及关于vim_dev和#vim IRC频道的各种讨论的主题。

Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals . 有些人(最重要的是Paul LeoNerd Evans)希望解决这个问题(即使是支持Vim的终端中的控制台Vim),并提出了各种提案

But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim 8 major release. 但截至今天,尚未有任何补丁或志愿者挺身而出,尽管许多人表示希望在未来的Vim 8主要版本中使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM