From 6ab14bf47412eadce8842dd392ddcc92fe45da48 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Fri, 8 Mar 2019 14:05:38 +0100 Subject: [PATCH] tabline: add consistent tab label to the end closes #1882 closes #1883 --- autoload/airline/extensions/tabline.vim | 6 ++++++ autoload/airline/extensions/tabline/buffers.vim | 4 +--- autoload/airline/extensions/tabline/tabs.vim | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/autoload/airline/extensions/tabline.vim b/autoload/airline/extensions/tabline.vim index 1b88e9cb..ff87e1b8 100644 --- a/autoload/airline/extensions/tabline.vim +++ b/autoload/airline/extensions/tabline.vim @@ -229,3 +229,9 @@ function! airline#extensions#tabline#add_label(dict, type) \ get(g:, 'airline#extensions#tabline#'.a:type.'_label', a:type)) endif endfunction + +function! airline#extensions#tabline#add_tab_label(dict) + if tabpagenr('$') > 1 + call a:dict.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$'))) + endif +endfunction diff --git a/autoload/airline/extensions/tabline/buffers.vim b/autoload/airline/extensions/tabline/buffers.vim index 0a71cd04..f191e7c1 100644 --- a/autoload/airline/extensions/tabline/buffers.vim +++ b/autoload/airline/extensions/tabline/buffers.vim @@ -140,9 +140,7 @@ function! airline#extensions#tabline#buffers#get() call airline#extensions#tabline#add_label(b, 'buffers') endif - if tabpagenr('$') > 1 - call b.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$'))) - endif + call airline#extensions#tabline#add_tab_label(b) let s:current_bufnr = cur let s:column_width = &columns diff --git a/autoload/airline/extensions/tabline/tabs.vim b/autoload/airline/extensions/tabline/tabs.vim index 7412cdd4..2ff29477 100644 --- a/autoload/airline/extensions/tabline/tabs.vim +++ b/autoload/airline/extensions/tabline/tabs.vim @@ -92,6 +92,7 @@ function! airline#extensions#tabline#tabs#get() call airline#extensions#tabline#add_label(b, 'buffers') endif endif + call airline#extensions#tabline#add_tab_label(b) let s:current_bufnr = curbuf let s:current_tabnr = curtab