Reputation: 60089
I'd like to map Ctrl-TAB
to gt
in Vim so that I can switch tabs with one keystroke.
I tried...
nmap <C-T> gt
nmap <C-Tab> gt
nmap <C-TAB> gt
That didn't work. How do you say "the tab key" in Vimese?
Upvotes: 56
Views: 49462
Reputation: 1
I got this working with Konsole 19.12.3. Here's how:
Backtab+Ctrl+Ansi
(or probably just Backtab+Ctrl-Ansi if you have a non-ANSI keyboard) to \E[27;6;9~
. Use the test area to confirm that the binding is working; it should echo the sequence above. Delete any binding that conflicts with it.Tab+Ctrl+Ansi
(or non-ANSI equivalent) to \E[27;5;9~
.nnoremap <C-Tab> :tabn<CR>
and nnoremap <C-S-Tab> :tabp<CR>
Upvotes: 0
Reputation: 23311
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>
Upvotes: 2
Reputation: 9434
If you are on a mac, then you can use Karabiner to remap keys. Here is how you can do it in steps:
Inside the <root>
node add the following configuration
<item>
<name>c-tab to s-tab LEFT</name>
<identifier>private.ctabtostabl</identifier>
<autogen>
__KeyToKey__
KeyCode::TAB, ModifierFlag::CONTROL_L,
KeyCode::TAB, ModifierFlag::SHIFT_L
</autogen>
</item>
<item>
<name>c-tab to s-tab RIGHT</name>
<identifier>private.ctabtostabr</identifier>
<autogen>
__KeyToKey__
KeyCode::TAB, ModifierFlag::CONTROL_R,
KeyCode::TAB, ModifierFlag::SHIFT_R
</autogen>
</item>
After saving the xml file, go back to Karabiner preferences, this time to "Change Key" tab, push the "Reload XML" button, and check the newly minted options. Now your control-tab should become shift-tab!
Upvotes: 1
Reputation: 423
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
Upvotes: 14
Reputation: 12413
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
Upvotes: 4
Reputation: 42657
It can be mapped in gvim, but terminals don't see a difference between <Tab>
and <C-Tab>
.
Upvotes: 77
Reputation: 24399
This worked for me in MacVim
:map <C-Tab> gt
It works in command mode. Not in Edit mode.
It does not work in vim in my terminal.
Upvotes: 0