I'm familiar with ngT
, which will move n tabs backward. Is there an equivalent way to move forward? I know that if I have 5 tabs open and I'm on tab 3, I can use 3gT
to move backwards to tab 5. However, this quickly becomes unwieldy as the number of tabs increases and I lose track of the exact number I'm on at a given time.
1 Answer
As far as I'm aware, there is no default way to do this. I looked into the ex command tabnext
, which accepts a count, but functions exactly the same as gt
(that is, it moves to tab page {count}, not {count} pages forward):
:tabn[ext] {count}
{count}<C-PageDown>
{count}gt Go to tab page {count}. The first tab page has number one.
However, this isn't very hard to configure! This vimscript mapping does what you're looking for:
nnoremap <leader>gt :<C-u>exec 'normal '.repeat("gt", v:count1)<cr>
This literally just simulates pressing gt
over and over as many times as you need. With no count given, it will default to 1.
I picked <leader>gt
somewhat arbitrarily. Of course, you can remap this to whatever is easiest or most convenient for you, whether it's a separate binding, or you choose to override the default gt
.
:set switchbuf=usetab
and:sb
to switch between buffers. See:h 'swb'
and:h :sb
. It isn't perfect but may provide some usefulness