I can't really explain why it works like this, my best guess is that you more often need to go a tab by its index rather than going 3 tabs forwards.
However, if you really don't like how Vim works and want to be able to "undo" a
2gt you can add the following to your vimrc:
function! Mygt(forward, count)
let loop = a:count
while loop > 0
let loop = loop -1
nnoremap <silent> gt :<C-U>execute "call Mygt(1, " . v:count1 . ")"<CR>
nnoremap <silent> gT :<C-U>execute "call Mygt(0, " . v:count1 . ")"<CR>
Mygt() is pretty straightforward: it takes 2 arguments, the first one is used to define if you want to go forward or backward in the list of tabs and the second one is how many tabs you want to skip. So it loops on the given count and repeats
gT according to the first parameter.
You can try it with
:call Mygt(1, 2) or
:call Mygt(0, 4)
To make it easier to use, we also remap
<silent> is used to avoid prompting the function called by the mapping. (see
<C-u> is used to remove characters on the command line, it is used to allow a count to the mapping (see
- We build the string which will contain the command to execute (e.g.
call Mygt(1, 3) and execute it with
- And finally, we use the count given to the mapping with
v:count1 which will default to
1 if no count is given. (see
:h v:count and
All of this allows us to use
5gT and get a "consistent" behavior.