From 661c5fb0c5ae6a97837f882901e9d700dfedf2fa Mon Sep 17 00:00:00 2001 From: Lingnan Dai Date: Sun, 1 Mar 2015 00:18:02 +0000 Subject: [PATCH] tabline -- added AirlineSelect{NextTab,PrevTab} commands with countable support --- autoload/airline/extensions/tabline/buffers.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/autoload/airline/extensions/tabline/buffers.vim b/autoload/airline/extensions/tabline/buffers.vim index 728b7ad..4f14a9b 100644 --- a/autoload/airline/extensions/tabline/buffers.vim +++ b/autoload/airline/extensions/tabline/buffers.vim @@ -172,6 +172,14 @@ function! s:select_tab(buf_index) endif endfunction +function! s:jump_to_tab(offset) + let l = s:current_visible_buffers + let i = index(l, bufnr('%')) + if i > -1 + exec 'b!' . l[float2nr(fmod(i + a:offset, len(l)))] + endif +endfunction + if s:buffer_idx_mode noremap AirlineSelectTab1 :call select_tab(0) noremap AirlineSelectTab2 :call select_tab(1) @@ -182,4 +190,6 @@ if s:buffer_idx_mode noremap AirlineSelectTab7 :call select_tab(6) noremap AirlineSelectTab8 :call select_tab(7) noremap AirlineSelectTab9 :call select_tab(8) + noremap AirlineSelectPrevTab :call jump_to_tab(-v:count1) + noremap AirlineSelectNextTab :call jump_to_tab(v:count1) endif