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?
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)