extract syntastic

This commit is contained in:
Bailey Ling 2013-08-06 02:56:30 +00:00
parent f15ac2146f
commit 11fd24b3ef
5 changed files with 25 additions and 9 deletions

View File

@ -19,8 +19,6 @@ function! airline#extensions#apply_left_override(section1, section2)
endfunction
function! airline#extensions#update_external_values()
let g:airline_externals_syntastic = g:airline_enable_syntastic && exists('*SyntasticStatuslineFlag')
\ ? '%#warningmsg#%{SyntasticStatuslineFlag()}' : ''
let g:airline_externals_branch = g:airline_enable_branch
\ ? (exists('*fugitive#head') && strlen(fugitive#head()) > 0
\ ? g:airline_branch_prefix.fugitive#head()
@ -120,10 +118,14 @@ function! airline#extensions#load()
endif
if get(g:, 'command_t_loaded', 0)
call add(g:airline_statusline_funcrefs, function('airline#extensions#commandt#apply_window_override'))
call airline#extensions#commandt#init(s:ext)
endif
if g:airline_enable_bufferline && get(g:, 'loaded_bufferline', 0)
if g:airline_enable_syntastic && get(g:, 'loaded_syntastic_plugin')
call airline#extensions#syntastic#init(s:ext)
endif
if g:airline_enable_bufferline && exists('*bufferline#get_status_string')
call airline#extensions#bufferline#init(s:ext)
endif

View File

@ -14,7 +14,5 @@ function! airline#extensions#bufferline#init(ext)
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
call a:ext.add_statusline_funcref(function('airline#extensions#bufferline#apply'))
endfunction

View File

@ -1,8 +1,12 @@
" MIT license. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
function! airline#extensions#commandt#apply_window_override()
function! airline#extensions#commandt#apply()
if bufname('%') ==# 'GoToFile'
call airline#extensions#apply_left_override('CommandT', '')
endif
endfunction
function! airline#extensions#commandt#init(ext)
call ext.add_statusline_funcref(function('airline#extensions#commandt#apply'))
endfunction

View File

@ -0,0 +1,12 @@
" MIT license. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
function! airline#extensions#syntastic#apply()
let w:airline_section_gutter = '%#warningmsg#%{SyntasticStatuslineFlag()}'
endfunction
function! airline#extensions#syntastic#init(ext)
if g:airline_enable_syntastic && exists('*SyntasticStatuslineFlag')
call a:ext.add_statusline_funcref(function('airline#extensions#syntastic#apply'))
endif
endfunction

View File

@ -58,7 +58,7 @@ function! s:on_window_changed()
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', '%f%m')
call s:check_defined('g:airline_section_gutter', g:airline_externals_syntastic)
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_y', "%{strlen(&fenc)>0?&fenc:''}%{strlen(&ff)>0?'['.&ff.']':''}")
call s:check_defined('g:airline_section_z', '%3p%% '.g:airline_linecolumn_prefix.'%3l:%3c')