简体   繁体   中英

.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. I am using gnome terminal in ubuntu 11.10, the control key mappings does not seem to work. could any one tell what I am doing wrong.

VIM - Vi IMproved version 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> / <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.

Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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