avoid using funcrefs in the core implementation (#91).
This commit is contained in:
parent
34675c5d9b
commit
dcc0c7c84b
|
@ -66,27 +66,6 @@ function! s:is_excluded_window()
|
|||
return 0
|
||||
endfunction
|
||||
|
||||
function! s:apply_window_overrides()
|
||||
call airline#extensions#clear_window_overrides()
|
||||
|
||||
if &buftype == 'quickfix'
|
||||
let w:airline_section_a = 'Quickfix'
|
||||
let w:airline_section_b = ''
|
||||
let w:airline_section_c = ''
|
||||
let w:airline_section_x = ''
|
||||
endif
|
||||
|
||||
if &previewwindow
|
||||
let w:airline_section_a = 'Preview'
|
||||
let w:airline_section_b = ''
|
||||
let w:airline_section_c = bufname(winbufnr(winnr()))
|
||||
endif
|
||||
|
||||
for FuncRef in g:airline_window_override_funcrefs
|
||||
call FuncRef()
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! airline#update_externals()
|
||||
let g:airline_externals_bufferline = g:airline_enable_bufferline && exists('*bufferline#get_status_string')
|
||||
\ ? '%{bufferline#refresh_status()}'.bufferline#get_status_string()
|
||||
|
@ -109,7 +88,7 @@ function! airline#update_statusline(active)
|
|||
endif
|
||||
|
||||
call airline#update_externals()
|
||||
call s:apply_window_overrides()
|
||||
call airline#extensions#apply_window_overrides()
|
||||
|
||||
let l:mode_color = a:active ? "%#Al2#" : "%#Al2_inactive#"
|
||||
let l:mode_sep_color = a:active ? "%#Al3#" : "%#Al3_inactive#"
|
||||
|
|
|
@ -7,14 +7,25 @@ function! s:override_left_only(section1, section2)
|
|||
let w:airline_left_only = 1
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#clear_window_overrides()
|
||||
function! airline#extensions#apply_window_overrides()
|
||||
unlet! w:airline_left_only
|
||||
for section in s:sections
|
||||
unlet! w:airline_section_{section}
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#apply_window_overrides()
|
||||
if &buftype == 'quickfix'
|
||||
let w:airline_section_a = 'Quickfix'
|
||||
let w:airline_section_b = ''
|
||||
let w:airline_section_c = ''
|
||||
let w:airline_section_x = ''
|
||||
endif
|
||||
|
||||
if &previewwindow
|
||||
let w:airline_section_a = 'Preview'
|
||||
let w:airline_section_b = ''
|
||||
let w:airline_section_c = bufname(winbufnr(winnr()))
|
||||
endif
|
||||
|
||||
if &ft == 'netrw'
|
||||
call s:override_left_only('netrw', '%f')
|
||||
elseif &ft == 'unite'
|
||||
|
@ -36,6 +47,10 @@ function! airline#extensions#apply_window_overrides()
|
|||
elseif &ft == 'minibufexpl'
|
||||
call s:override_left_only('MiniBufExplorer', '')
|
||||
endif
|
||||
|
||||
for Fn in g:airline_window_override_funcrefs
|
||||
call Fn()
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#load()
|
||||
|
@ -59,7 +74,5 @@ function! airline#extensions#load()
|
|||
let g:bufferline_active_buffer_right = ''
|
||||
let g:bufferline_separator = ' '
|
||||
endif
|
||||
|
||||
call add(g:airline_window_override_funcrefs, function('airline#extensions#apply_window_overrides'))
|
||||
endfunction
|
||||
|
||||
|
|
Loading…
Reference in New Issue