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.
This commit is contained in:
Christian Brabandt 2018-01-04 18:34:48 +01:00
parent 45878a7947
commit 3985ece131
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
3 changed files with 12 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -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'