extract fugitive/lawrencium
This commit is contained in:
parent
11fd24b3ef
commit
9c960875fe
@ -19,13 +19,6 @@ function! airline#extensions#apply_left_override(section1, section2)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#extensions#update_external_values()
|
function! airline#extensions#update_external_values()
|
||||||
let g:airline_externals_branch = g:airline_enable_branch
|
|
||||||
\ ? (exists('*fugitive#head') && strlen(fugitive#head()) > 0
|
|
||||||
\ ? g:airline_branch_prefix.fugitive#head()
|
|
||||||
\ : exists('*lawrencium#statusline') && strlen(lawrencium#statusline()) > 0
|
|
||||||
\ ? g:airline_branch_prefix.lawrencium#statusline()
|
|
||||||
\ : '')
|
|
||||||
\ : ''
|
|
||||||
let g:airline_externals_tagbar = g:airline_enable_tagbar && exists(':Tagbar')
|
let g:airline_externals_tagbar = g:airline_enable_tagbar && exists(':Tagbar')
|
||||||
\ ? '%(%{tagbar#currenttag("%s","")} '.g:airline_right_alt_sep.' %)' : ''
|
\ ? '%(%{tagbar#currenttag("%s","")} '.g:airline_right_alt_sep.' %)' : ''
|
||||||
endfunction
|
endfunction
|
||||||
@ -121,6 +114,10 @@ function! airline#extensions#load()
|
|||||||
call airline#extensions#commandt#init(s:ext)
|
call airline#extensions#commandt#init(s:ext)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if g:airline_enable_branch && (get(g:, 'loaded_fugitive', 0) || get(g:, 'loaded_lawrencium', 0))
|
||||||
|
call airline#extensions#branch#init(s:ext)
|
||||||
|
endif
|
||||||
|
|
||||||
if g:airline_enable_syntastic && get(g:, 'loaded_syntastic_plugin')
|
if g:airline_enable_syntastic && get(g:, 'loaded_syntastic_plugin')
|
||||||
call airline#extensions#syntastic#init(s:ext)
|
call airline#extensions#syntastic#init(s:ext)
|
||||||
endif
|
endif
|
||||||
|
16
autoload/airline/extensions/branch.vim
Normal file
16
autoload/airline/extensions/branch.vim
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
" MIT license. Copyright (c) 2013 Bailey Ling.
|
||||||
|
" vim: ts=2 sts=2 sw=2 fdm=indent
|
||||||
|
|
||||||
|
function! airline#extensions#branch#apply()
|
||||||
|
let w:airline_section_b =
|
||||||
|
\ exists('*fugitive#head') && strlen(fugitive#head()) > 0
|
||||||
|
\ ? g:airline_branch_prefix.fugitive#head()
|
||||||
|
\ : exists('*lawrencium#statusline') && strlen(lawrencium#statusline()) > 0
|
||||||
|
\ ? g:airline_branch_prefix.lawrencium#statusline()
|
||||||
|
\ : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! airline#extensions#branch#init(ext)
|
||||||
|
call a:ext.add_statusline_funcref(function('airline#extensions#branch#apply'))
|
||||||
|
endfunction
|
||||||
|
|
@ -56,7 +56,7 @@ function! s:on_window_changed()
|
|||||||
call airline#extensions#load()
|
call airline#extensions#load()
|
||||||
call airline#load_theme(g:airline_theme)
|
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_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_b', '')
|
||||||
call s:check_defined('g:airline_section_c', '%f%m')
|
call s:check_defined('g:airline_section_c', '%f%m')
|
||||||
call s:check_defined('g:airline_section_gutter', '')
|
call s:check_defined('g:airline_section_gutter', '')
|
||||||
call s:check_defined('g:airline_section_x', g:airline_externals_tagbar."%{strlen(&filetype)>0?&filetype:''}")
|
call s:check_defined('g:airline_section_x', g:airline_externals_tagbar."%{strlen(&filetype)>0?&filetype:''}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user