Skip to main content
deleted 4 characters in body
Source Link

Deviating from the behaviour for gT, the above answers won't handle g<Tab> nicely, as it will appear to vim as if one separately asked to go to the next tab page multiple times. Calculating the jump destination directly solves the problem.

One more subtlety is to prepend the mapping with @_. Execution of a black hole macro does nothing, but consumes the count passed to the mapping, so that we may pass another count from our mapping, in our case, giving the calculated destination tab page as a count to gt.

nnoremap <expr> g<C-t>gt '@_' . (1 + ((tabpagenr () - 1 + v:count1) % tabpagenr ('$'))) . 'gt'

Deviating from the behaviour for gT, the above answers won't handle g<Tab> nicely, as it will appear to vim as if one separately asked to go to the next tab page multiple times. Calculating the jump destination directly solves the problem.

One more subtlety is to prepend the mapping with @_. Execution of a black hole macro does nothing, but consumes the count passed to the mapping, so that we may pass another count from our mapping, in our case, giving the calculated destination tab page as a count to gt.

nnoremap <expr> g<C-t> '@_' . (1 + ((tabpagenr () - 1 + v:count1) % tabpagenr ('$'))) . 'gt'

Deviating from the behaviour for gT, the above answers won't handle g<Tab> nicely, as it will appear to vim as if one separately asked to go to the next tab page multiple times. Calculating the jump destination directly solves the problem.

One more subtlety is to prepend the mapping with @_. Execution of a black hole macro does nothing, but consumes the count passed to the mapping, so that we may pass another count from our mapping, in our case, giving the calculated destination tab page as a count to gt.

nnoremap <expr> gt '@_' . (1 + ((tabpagenr () - 1 + v:count1) % tabpagenr ('$'))) . 'gt'
added 8 characters in body
Source Link

UnlikeDeviating from the behaviour for gT, the above answers won't handle g<Tab> nicely, as it will appear to vim as if one separately asked to go to the next tab page multiple times. Calculating the jump destination directly solves the problem.

One more subtlety is to prepend the mapping with @_. Execution of a black hole macro does nothing, but consumes the count passed to the mapping, so that we may pass another count from our mapping, in our case, giving the calculated destination tab page as a count to gt.

nnoremap <expr> g<C-t> '@_' . (1 + ((tabpagenr () - 1 + v:count1) % tabpagenr ('$'))) . 'gt'

Unlike the behaviour for gT, the above answers won't handle g<Tab> nicely, as it will appear to vim as if one separately asked to go to the next tab page multiple times. Calculating the jump destination directly solves the problem.

One more subtlety is to prepend the mapping with @_. Execution of a black hole macro does nothing, but consumes the count passed to the mapping, so that we may pass another count from our mapping, in our case, giving the calculated destination tab page as a count to gt.

nnoremap <expr> g<C-t> '@_' . (1 + ((tabpagenr () - 1 + v:count1) % tabpagenr ('$'))) . 'gt'

Deviating from the behaviour for gT, the above answers won't handle g<Tab> nicely, as it will appear to vim as if one separately asked to go to the next tab page multiple times. Calculating the jump destination directly solves the problem.

One more subtlety is to prepend the mapping with @_. Execution of a black hole macro does nothing, but consumes the count passed to the mapping, so that we may pass another count from our mapping, in our case, giving the calculated destination tab page as a count to gt.

nnoremap <expr> g<C-t> '@_' . (1 + ((tabpagenr () - 1 + v:count1) % tabpagenr ('$'))) . 'gt'
Source Link

Unlike the behaviour for gT, the above answers won't handle g<Tab> nicely, as it will appear to vim as if one separately asked to go to the next tab page multiple times. Calculating the jump destination directly solves the problem.

One more subtlety is to prepend the mapping with @_. Execution of a black hole macro does nothing, but consumes the count passed to the mapping, so that we may pass another count from our mapping, in our case, giving the calculated destination tab page as a count to gt.

nnoremap <expr> g<C-t> '@_' . (1 + ((tabpagenr () - 1 + v:count1) % tabpagenr ('$'))) . 'gt'