Is there any shortcuts to switch the Tabs from one to another in MacVim ?

MacVim Tabs

Else, any tips to bind the shortcuts myself in .vimrc like ⌘ + 1 for Tab 1 and ⌘ + 2 for Tab 2 . For example, like switching browser tabs.

link|improve this question

feedback

2 Answers

I have the following in my ~/.vimrc for Linux. You should be able to change the "<M-" sequence to "<D-" to get what you want:

" Meta+1-0 jumps to tab 1-10, Shift+Meta+1-0 jumps to tab 11-20:
let s:windowmapnr = 0
let s:wins='1234567890!@#$%^&*()'
while (s:windowmapnr < strlen(s:wins))
    exe 'noremap <silent> <M-' . s:wins[s:windowmapnr] . '> ' . (s:windowmapnr + 1) . 'gt'
    exe 'inoremap <silent> <M-' . s:wins[s:windowmapnr] . '> <C-O>' . (s:windowmapnr + 1) . 'gt'
    exe 'cnoremap <silent> <M-' . s:wins[s:windowmapnr] . '> <C-C>' . (s:windowmapnr + 1) . 'gt'
    exe 'vnoremap <silent> <M-' . s:wins[s:windowmapnr] . '> <C-C>' . (s:windowmapnr + 1) . 'gt'
    let s:windowmapnr += 1
endwhile
unlet s:windowmapnr s:wins
link|improve this answer
feedback

Since MacVim is an actual program on Mac OS, you can map tab switching the same way you map commands in any program (which I personally just learned about recently).

Open up System Preferences, select "Keyboard", then "Application Shortcuts" (in the left menu). Under the menu on the right, click on the plus (+) to add a new command. Choose MacVim for the application, and for the menu title, type "Select Next Tab", and choose a shortcut (I chose Cmd+right arrow). Then do the same thing for the command "Select Previous Tab".

"Select Next Tab" and "Select Previous Tab" are found in MacVim under the "Window" menu. Any option you see in any of the menus for an app can be remapped using this method.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.