tabline: refactor s:variables
This commit is contained in:
parent
69aa1e93b3
commit
503b9977fb
@ -3,15 +3,7 @@
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:show_close_button = get(g:, 'airline#extensions#tabline#show_close_button', 1)
|
||||
let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1)
|
||||
let s:show_tab_nr = get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
|
||||
let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
|
||||
let s:close_symbol = get(g:, 'airline#extensions#tabline#close_symbol', 'X')
|
||||
let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs')
|
||||
let s:show_splits = get(g:, 'airline#extensions#tabline#show_splits', 1)
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
let s:current_bufnr = -1
|
||||
let s:current_tabnr = -1
|
||||
let s:current_modified = 0
|
||||
@ -47,6 +39,7 @@ function! airline#extensions#tabline#tabs#get()
|
||||
endif
|
||||
endif
|
||||
|
||||
let tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
|
||||
let b = airline#extensions#tabline#new_builder()
|
||||
|
||||
for i in range(1, tabpagenr('$'))
|
||||
@ -64,10 +57,11 @@ function! airline#extensions#tabline#tabs#get()
|
||||
let group = 'airline_tab'
|
||||
endif
|
||||
let val = '%('
|
||||
if s:show_tab_nr
|
||||
if s:tab_nr_type == 0
|
||||
|
||||
if get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
|
||||
if tab_nr_type == 0
|
||||
let val .= (g:airline_symbols.space).'%{len(tabpagebuflist('.i.'))}'
|
||||
elseif s:tab_nr_type == 1
|
||||
elseif tab_nr_type == 1
|
||||
let val .= (g:airline_symbols.space).i
|
||||
else "== 2
|
||||
let val .= (g:airline_symbols.space).i.'.%{len(tabpagebuflist('.i.'))}'
|
||||
@ -80,18 +74,20 @@ function! airline#extensions#tabline#tabs#get()
|
||||
call b.split()
|
||||
call b.add_section('airline_tabfill', '')
|
||||
|
||||
if s:show_close_button
|
||||
call b.add_section('airline_tab_right', ' %999X'.s:close_symbol.' ')
|
||||
if get(g:, 'airline#extensions#tabline#show_close_button', 1)
|
||||
call b.add_section('airline_tab_right', ' %999X'.
|
||||
\ get(g:, 'airline#extensions#tabline#close_symbol', 'X').' ')
|
||||
endif
|
||||
|
||||
if s:show_splits == 1
|
||||
if get(g:, 'airline#extensions#tabline#show_splits', 1) == 1
|
||||
let buffers = tabpagebuflist(curtab)
|
||||
for nr in buffers
|
||||
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 s:show_tab_type == 1
|
||||
call b.add_section_spaced('airline_tabtype', s:tabs_label)
|
||||
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
|
||||
|
||||
let s:current_bufnr = curbuf
|
||||
|
Loading…
x
Reference in New Issue
Block a user