views:

228

answers:

2

I have the following mappings in my .vimrc:

map <C-S-Tab> :tabprevious<CR>
nmap <C-S-Tab> :tabprevious<CR>
imap <C-S-Tab> <Esc>:tabprevious<CR>i

map <C-Tab> :tabnext<CR>
nmap <C-Tab> :tabnext<CR>
imap <C-Tab> <Esc>:tabnext<CR>i

I want to switch the tabs with Strg+Tab forward and with Strg+Shift+Tab backward. Why does this mapping not work?

A: 

Something is probably blocking vim from seeing the C-Tab. This could be your terminal or your window manager.

On some OSes/WMs you can set exceptions to the window manager shortcuts, but how you do this varies crazily between the WMs.

I'm not sure if there is a solution if it is your terminal blocking the key presses.

Michael Anderson
The window manager is not the problem. If I switch to a tty-terminal without X11/GUI, the binding still does not work. I use Ubuntu 9.04.
Fu86
A: 

Are you using xterm? If so, you can't map ctrl-tab without a lot of hackery. xterm and many other terminal emulators don't recognise ctrl-tab and simply send a tab character.

See my answer here for more details: http://stackoverflow.com/questions/2686766/mapping-c-tab-in-my-vimrc-fails-in-ubuntu

Or you can just use gvim if that is suitable - it should work without any mucking around.

nfm