Hi,
How do I make Vim switch to a certain tab when I hit Alt+# ? For example, to get to the third tab, I'd hit Alt+3 (like the behavior in Firefox).
Edit: also, how can I make Control + tab == gt, Control + shift + tab == gT
Hi,
How do I make Vim switch to a certain tab when I hit Alt+# ? For example, to get to the third tab, I'd hit Alt+3 (like the behavior in Firefox).
Edit: also, how can I make Control + tab == gt, Control + shift + tab == gT
:nmap <M-1> :tabnext 1<CR>
:nmap <M-2> :tabnext 2<CR>
etc.
See :h :tabnext
. Note that by default you can also do Ngt
in normal mode where N is the number of the tab you want (starting with 1).
This works for me (copied and pasted from my rc):
" Tab Control (others)
map <A-1> 1gt
map <A-2> 2gt
map <A-3> 3gt
map <A-4> 4gt
map <A-5> 5gt
map <A-6> 6gt
map <A-7> 7gt
map <A-8> 8gt
map <A-9> 9gt
Also further goodness:
map <C-Right> <ESC>:tabnext<CR>
map <C-Left> <ESC>:tabprev<CR>
map <C-t> <ESC>:tabnew<CR>
You may want to change it to nmap like the example above to restrict the usage a little better I've been a bit lazy in that respect.
Missed your edit next tab with Ctl-t would be:
map <C-t> :tabnext<CR>
I don't think the tabprevious mapping is possible in vim due to the way it handles uppercase characters see:
http://www.nabble.com/Maping-Ctrl-Shift-s-problems-td22918941.html
To save some time I spent hunting around when I wanted this