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.
Asked
Active
Viewed 773 times
7
Floegipoky
- 457
- 5
- 13
1 Answers
7
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.
DJMcMayhem
- 17,581
- 5
- 53
- 85
:set switchbuf=usetaband:sbto switch between buffers. See:h 'swb'and:h :sb. It isn't perfect but may provide some usefulness – Peter Rincker Feb 23 '17 at 18:54