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
|
endif
|
||||||
return group
|
return group
|
||||||
endfunction
|
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.add_section('airline_tabfill', '')
|
||||||
call b.split()
|
call b.split()
|
||||||
call b.add_section('airline_tabfill', '')
|
call b.add_section('airline_tabfill', '')
|
||||||
if get(g:, 'airline#extensions#tabline#show_tab_type', 1)
|
call airline#extensions#tabline#add_label(b, 'buffers')
|
||||||
call b.add_section_spaced('airline_tab',
|
|
||||||
\ get(g:, 'airline#extensions#tabline#buffers_label', '[buffers]'))
|
|
||||||
endif
|
|
||||||
|
|
||||||
if tabpagenr('$') > 1
|
if tabpagenr('$') > 1
|
||||||
call b.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
|
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 tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
|
||||||
let b = airline#extensions#tabline#new_builder()
|
let b = airline#extensions#tabline#new_builder()
|
||||||
|
|
||||||
if get(g:, 'airline#extensions#tabline#show_tab_type', 1)
|
call airline#extensions#tabline#add_label(b, 'buffers')
|
||||||
call b.add_section_spaced('airline_tab',
|
|
||||||
\ get(g:, 'airline#extensions#tabline#buffers_label', '[buffers]'))
|
|
||||||
endif
|
|
||||||
for i in range(1, tabpagenr('$'))
|
for i in range(1, tabpagenr('$'))
|
||||||
if i == curtab
|
if i == curtab
|
||||||
let group = 'airline_tabsel'
|
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.')}%)')
|
call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)')
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
if get(g:, 'airline#extensions#tabline#show_tab_type', 1) == 1
|
call airline#extensions#tabline#add_label(b, 'tabs')
|
||||||
call b.add_section_spaced('airline_tab',
|
|
||||||
\ get(g:, 'airline#extensions#tabline#tabs_label', '[tabs]'))
|
|
||||||
endif
|
|
||||||
|
|
||||||
let s:current_bufnr = curbuf
|
let s:current_bufnr = curbuf
|
||||||
let s:current_tabnr = curtab
|
let s:current_tabnr = curtab
|
||||||
|
|
Loading…
Reference in New Issue