mirror of
https://github.com/vim-airline/vim-airline-themes.git
synced 2024-12-12 05:22:12 +08:00
clearly separate core functionality from implementation
This commit is contained in:
parent
ec86f66510
commit
bce1632c42
|
@ -1,5 +1,6 @@
|
|||
" vim: ts=2 sts=2 sw=2 fdm=indent
|
||||
let s:is_win32term = (has('win32') || has('win64')) && !has('gui_running')
|
||||
let s:sections = ['a','b','c','gutter','x','y','z']
|
||||
|
||||
let s:airline_highlight_map = {
|
||||
\ 'mode' : 'Al2',
|
||||
|
@ -49,22 +50,24 @@ function! airline#highlight(modes)
|
|||
endfunction
|
||||
|
||||
function! s:is_excluded_window()
|
||||
for matchft in g:airline_exclude_filetypes
|
||||
if matchft ==# &ft
|
||||
for Fn in g:airline_exclude_funcrefs
|
||||
if Fn()
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
for matchw in g:airline_exclude_filenames
|
||||
if matchstr(expand('%'), matchw) ==# matchw
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
if g:airline_exclude_preview && &previewwindow
|
||||
return 1
|
||||
endif
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! s:apply_window_overrides()
|
||||
unlet! w:airline_left_only
|
||||
for section in s:sections
|
||||
unlet! w:airline_section_{section}
|
||||
endfor
|
||||
for Fn in g:airline_window_override_funcrefs
|
||||
call Fn()
|
||||
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()
|
||||
|
@ -87,7 +90,7 @@ function! airline#update_statusline(active)
|
|||
endif
|
||||
|
||||
call airline#update_externals()
|
||||
call airline#extensions#apply_window_overrides()
|
||||
call s:apply_window_overrides()
|
||||
|
||||
let l:mode_color = a:active ? "%#Al2#" : "%#Al2_inactive#"
|
||||
let l:mode_sep_color = a:active ? "%#Al3#" : "%#Al3_inactive#"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
let s:sections = ['a','b','c','gutter','x','y','z']
|
||||
|
||||
function! airline#extensions#apply_left_override(section1, section2)
|
||||
let w:airline_section_a = a:section1
|
||||
let w:airline_section_b = a:section2
|
||||
|
@ -8,11 +6,6 @@ function! airline#extensions#apply_left_override(section1, section2)
|
|||
endfunction
|
||||
|
||||
function! airline#extensions#apply_window_overrides()
|
||||
unlet! w:airline_left_only
|
||||
for section in s:sections
|
||||
unlet! w:airline_section_{section}
|
||||
endfor
|
||||
|
||||
if &buftype == 'quickfix'
|
||||
let w:airline_section_a = 'Quickfix'
|
||||
let w:airline_section_b = ''
|
||||
|
@ -50,10 +43,26 @@ function! airline#extensions#apply_window_overrides()
|
|||
elseif &ft == 'minibufexpl'
|
||||
call airline#extensions#apply_left_override('MiniBufExplorer', '')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
for Fn in g:airline_window_override_funcrefs
|
||||
call Fn()
|
||||
function! airline#extensions#is_excluded_window()
|
||||
for matchft in g:airline_exclude_filetypes
|
||||
if matchft ==# &ft
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
for matchw in g:airline_exclude_filenames
|
||||
if matchstr(expand('%'), matchw) ==# matchw
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
if g:airline_exclude_preview && &previewwindow
|
||||
return 1
|
||||
endif
|
||||
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#load()
|
||||
|
@ -81,5 +90,8 @@ 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'))
|
||||
call add(g:airline_exclude_funcrefs, function('airline#extensions#is_excluded_window'))
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerSt
|
|||
call s:check_defined('g:airline_exclude_filetypes', [])
|
||||
call s:check_defined('g:airline_exclude_preview', 0)
|
||||
call s:check_defined('g:airline_window_override_funcrefs', [])
|
||||
call s:check_defined('g:airline_exclude_funcrefs', [])
|
||||
|
||||
call s:check_defined('g:airline_mode_map', {
|
||||
\ 'n' : 'NORMAL',
|
||||
|
|
Loading…
Reference in New Issue
Block a user