How can I map Ctrl-TAB to something in Vim?

Solution 1:

It can be mapped in gvim, but terminals don't see a difference between <Tab> and <C-Tab>.

Solution 2:

You can't. Tab is already a control key, <C-i>.

Solution 3:

It works on gVim. Just add this at the end of your ~/.gvimrc file:

" Add keyboard shortcuts
map <C-Tab> gt
map <C-S-Tab> gT

Solution 4:

I use the mintty terminal in cygwin. This terminal has an option of using ctrl-tab to cycle between the various instances of cygwing or alternatively, you can use to go to the next or previous screen window (so ctrl-tab does the same as ctrl-a+n and s-ctrl-tab does the same as ctrl-a+p. This last behavior is very convenient in my opinion. Check

Using_Ctrl+Tab_to_switch_session_in_GNU_Screen

Solution 5:

git-bash (mintty)

First, disable the Switch window option in Options > Keys. Then you can use the following maps.

Note: you cannot simply copy and paste these into your .vimrc. Instead, where ^[[1;6I is, you need to press Ctrl-V while in insert mode and then type Ctrl-Shift-Tab. The same goes for ^[[1;5I and Ctrl-Tab.

nnoremap ^[[1;6I :tabprevious<CR>
nnoremap ^[[1;5I :tabnext<CR>
inoremap ^[[1;6I <Esc>:tabprevious<CR>
inoremap ^[[1;5I <Esc>:tabnext<CR>