tabline: refactor label function
This commit is contained in:
parent
3985ece131
commit
3b631ef0c4
@ -201,3 +201,10 @@ function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr)
|
||||
endif
|
||||
return group
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#add_label(dict, type)
|
||||
if get(g:, 'airline#extensions#tabline#show_tab_type', 1)
|
||||
call a:dict.add_section_spaced('airline_tab',
|
||||
\ get(g:, 'airline#extensions#tabline#'.a:type.'_label', '['.a:type.']'))
|
||||
endif
|
||||
endfunction
|
||||
|
@ -97,10 +97,7 @@ function! airline#extensions#tabline#buffers#get()
|
||||
call b.add_section('airline_tabfill', '')
|
||||
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_tab',
|
||||
\ get(g:, 'airline#extensions#tabline#buffers_label', '[buffers]'))
|
||||
endif
|
||||
call airline#extensions#tabline#add_label(b, 'buffers')
|
||||
|
||||
if tabpagenr('$') > 1
|
||||
call b.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
|
||||
|
@ -42,10 +42,7 @@ 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
|
||||
call airline#extensions#tabline#add_label(b, 'buffers')
|
||||
for i in range(1, tabpagenr('$'))
|
||||
if i == curtab
|
||||
let group = 'airline_tabsel'
|
||||
@ -90,10 +87,7 @@ function! airline#extensions#tabline#tabs#get()
|
||||
call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)')
|
||||
endfor
|
||||
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
|
||||
call airline#extensions#tabline#add_label(b, 'tabs')
|
||||
|
||||
let s:current_bufnr = curbuf
|
||||
let s:current_tabnr = curtab
|
||||
|
Loading…
Reference in New Issue
Block a user