make bufferline almost entirely self contained
This commit is contained in:
parent
41325bd08c
commit
f15ac2146f
|
@ -1,6 +1,15 @@
|
|||
" MIT license. Copyright (c) 2013 Bailey Ling.
|
||||
" vim: ts=2 sts=2 sw=2 fdm=indent
|
||||
|
||||
let s:ext = {}
|
||||
let s:ext._cursormove_funcrefs = []
|
||||
function! s:ext.add_statusline_funcref(funcref) dict
|
||||
call add(g:airline_statusline_funcrefs, a:funcref)
|
||||
endfunction
|
||||
function! s:ext.add_cursormove_funcref(funcref) dict
|
||||
call add(self._cursormove_funcrefs, a:funcref)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#apply_left_override(section1, section2)
|
||||
let w:airline_section_a = a:section1
|
||||
let w:airline_section_b = a:section2
|
||||
|
@ -10,8 +19,6 @@ function! airline#extensions#apply_left_override(section1, section2)
|
|||
endfunction
|
||||
|
||||
function! airline#extensions#update_external_values()
|
||||
let g:airline_externals_bufferline = g:airline_enable_bufferline && exists('*bufferline#get_status_string')
|
||||
\ ? '%{bufferline#refresh_status()}'.bufferline#get_status_string() : "%f%m"
|
||||
let g:airline_externals_syntastic = g:airline_enable_syntastic && exists('*SyntasticStatuslineFlag')
|
||||
\ ? '%#warningmsg#%{SyntasticStatuslineFlag()}' : ''
|
||||
let g:airline_externals_branch = g:airline_enable_branch
|
||||
|
@ -117,7 +124,7 @@ function! airline#extensions#load()
|
|||
endif
|
||||
|
||||
if g:airline_enable_bufferline && get(g:, 'loaded_bufferline', 0)
|
||||
call airline#extensions#bufferline#init()
|
||||
call airline#extensions#bufferline#init(s:ext)
|
||||
endif
|
||||
|
||||
call add(g:airline_statusline_funcrefs, function('airline#extensions#update_external_values'))
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
" MIT license. Copyright (c) 2013 Bailey Ling.
|
||||
" vim: ts=2 sts=2 sw=2 fdm=indent
|
||||
|
||||
function! airline#extensions#bufferline#init()
|
||||
function! airline#extensions#bufferline#apply()
|
||||
let w:airline_section_c = '%{bufferline#refresh_status()}'.bufferline#get_status_string()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#bufferline#init(ext)
|
||||
highlight AlBl_active gui=bold cterm=bold term=bold
|
||||
highlight link AlBl_inactive Al6
|
||||
let g:bufferline_inactive_highlight = 'AlBl_inactive'
|
||||
|
@ -9,4 +13,8 @@ function! airline#extensions#bufferline#init()
|
|||
let g:bufferline_active_buffer_left = ''
|
||||
let g:bufferline_active_buffer_right = ''
|
||||
let g:bufferline_separator = ' '
|
||||
|
||||
if g:airline_enable_bufferline && exists('*bufferline#get_status_string')
|
||||
call a:ext.add_statusline_funcref(function('airline#extensions#bufferline#apply'))
|
||||
endif
|
||||
endfunction
|
||||
|
|
|
@ -57,7 +57,7 @@ function! s:on_window_changed()
|
|||
call airline#load_theme(g:airline_theme)
|
||||
call s:check_defined('g:airline_section_a', '%{g:airline_current_mode_text}')
|
||||
call s:check_defined('g:airline_section_b', '%{g:airline_externals_branch}')
|
||||
call s:check_defined('g:airline_section_c', g:airline_externals_bufferline)
|
||||
call s:check_defined('g:airline_section_c', '%f%m')
|
||||
call s:check_defined('g:airline_section_gutter', g:airline_externals_syntastic)
|
||||
call s:check_defined('g:airline_section_x', g:airline_externals_tagbar."%{strlen(&filetype)>0?&filetype:''}")
|
||||
call s:check_defined('g:airline_section_y', "%{strlen(&fenc)>0?&fenc:''}%{strlen(&ff)>0?'['.&ff.']':''}")
|
||||
|
|
Loading…
Reference in New Issue