I was trying to switch from a tab to another tab (which may not be adjacent to the previous tab) in VIM. Is there any shortcut for that, like we have Ctrl-p/Ctrl-n for switching to adjacent tabs?
Also, I was trying to write a key mapping which will give a variable as input to a function and do the operation. For instance, let's say I press Ctrl-5 and a function (written by the user) will be called and given as input 5, and the cursor will go to tab 5 (if there is any 5th tab opened).
Can you please suggest how this can be done?
Ctrl + → arrow will switch to tab that is on the right of current tab.
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".
To move from the current Vim window to the next one, type CTRL-W j (or CTRL-W <down> or CTRL-W CTRL-J). The CTRL-W is the mnemonic for “window” command, and the j is analogous to Vim's j command, which moves the cursor to the next line.
use 5gt
to switch to tab 5
:tabn[ext] {count}
{count}gt
Go to tab page {count}. The first tab page has number one.
you can also bind it to a key:
:map <C-5> 5gt :imap <C-5> <C-O>5gt
(Mapping Ctrl-<number>
could be different/impossible for some terminals. Consider Alt-<number>
then)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With