From 3985ece131655ccc0a457f41e549d8f656ed190c Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 4 Jan 2018 18:34:48 +0100 Subject: [PATCH] tabline: add [buffers]/[tabs] labels consistently previously, when both tabs and buffers were displayed in the tabline, it was not immediately obvious which side belongs to a buffer and which one to a tab. Therefore, add [buffers]/[tabs] labels consistently. --- autoload/airline/extensions/tabline/buffers.vim | 4 ++-- autoload/airline/extensions/tabline/tabs.vim | 11 ++++++++--- doc/airline.txt | 7 ++----- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/autoload/airline/extensions/tabline/buffers.vim b/autoload/airline/extensions/tabline/buffers.vim index 66d0d16e..706f2971 100644 --- a/autoload/airline/extensions/tabline/buffers.vim +++ b/autoload/airline/extensions/tabline/buffers.vim @@ -98,8 +98,8 @@ function! airline#extensions#tabline#buffers#get() call b.split() call b.add_section('airline_tabfill', '') if get(g:, 'airline#extensions#tabline#show_tab_type', 1) - call b.add_section_spaced('airline_tabtype', - \ get(g:, 'airline#extensions#tabline#buffers_label', 'buffers')) + call b.add_section_spaced('airline_tab', + \ get(g:, 'airline#extensions#tabline#buffers_label', '[buffers]')) endif if tabpagenr('$') > 1 diff --git a/autoload/airline/extensions/tabline/tabs.vim b/autoload/airline/extensions/tabline/tabs.vim index 1a18bdab..79f3f007 100644 --- a/autoload/airline/extensions/tabline/tabs.vim +++ b/autoload/airline/extensions/tabline/tabs.vim @@ -42,6 +42,10 @@ function! airline#extensions#tabline#tabs#get() let tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0) let b = airline#extensions#tabline#new_builder() + if get(g:, 'airline#extensions#tabline#show_tab_type', 1) + call b.add_section_spaced('airline_tab', + \ get(g:, 'airline#extensions#tabline#buffers_label', '[buffers]')) + endif for i in range(1, tabpagenr('$')) if i == curtab let group = 'airline_tabsel' @@ -85,9 +89,10 @@ function! airline#extensions#tabline#tabs#get() let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) . "_right" call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)') endfor - elseif get(g:, 'airline#extensions#tabline#show_tab_type', 1) == 1 - call b.add_section_spaced('airline_tabtype', - \get(g:, 'airline#extensions#tabline#tabs_label', 'tabs')) + endif + if get(g:, 'airline#extensions#tabline#show_tab_type', 1) == 1 + call b.add_section_spaced('airline_tab', + \ get(g:, 'airline#extensions#tabline#tabs_label', '[tabs]')) endif let s:current_bufnr = curbuf diff --git a/doc/airline.txt b/doc/airline.txt index 95a201b0..45b67d11 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -652,7 +652,7 @@ are supported! * enable/disable displaying open splits per tab (only when tabs are opened). > let g:airline#extensions#tabline#show_splits = 1 - * + * switch position of buffers and tabs on splited tabline (c) (only supported for ctrlspace plugin). > let g:airline#extensions#tabline#switch_buffers_and_tabs = 0 @@ -689,11 +689,8 @@ with the middle mouse button to delete that buffer. * enable/disable displaying tab number in tabs mode. > let g:airline#extensions#tabline#show_tab_nr = 1 -* enable/disable displaying tab type (far right) > +* enable/disable displaying tab type (e.g. [buffers]/[tabs]) > let g:airline#extensions#tabline#show_tab_type = 1 -< - Note: The tab-type will only be displayed in tab-mode, - if there are no splits shown. (See: g:airline#extensions#tabline#show_splits) * rename label for buffers (default: 'buffers') (c) > let g:airline#extensions#tabline#buffers_label = 'b'