From cbb9bea9dbcfe2fb896d91212a15db60d1cc0043 Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Tue, 20 Aug 2013 15:02:17 +0000 Subject: [PATCH] allow warning section to be overwritten (#136). --- autoload/airline/extensions.vim | 16 +++++++++------- autoload/airline/extensions/syntastic.vim | 5 +++-- plugin/airline.vim | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/autoload/airline/extensions.vim b/autoload/airline/extensions.vim index e070dde..e778af4 100644 --- a/autoload/airline/extensions.vim +++ b/autoload/airline/extensions.vim @@ -153,18 +153,20 @@ function! airline#extensions#load() call airline#extensions#branch#init(s:ext) endif - if (get(g:, 'airline#extensions#syntastic#enabled', 1) && get(g:, 'airline_enable_syntastic', 1)) - \ && exists(':SyntasticCheck') - call airline#extensions#syntastic#init(s:ext) - endif - if (get(g:, 'airline#extensions#bufferline#enabled', 1) && get(g:, 'airline_enable_bufferline', 1)) \ && exists('*bufferline#get_status_string') call airline#extensions#bufferline#init(s:ext) endif - if (get(g:, 'airline#extensions#whitespace#enabled', 1) && get(g:, 'airline_detect_whitespace', 1)) - call airline#extensions#whitespace#init() + if g:airline_section_warning == '__' + if (get(g:, 'airline#extensions#syntastic#enabled', 1) && get(g:, 'airline_enable_syntastic', 1)) + \ && exists(':SyntasticCheck') + call airline#extensions#syntastic#init(s:ext) + endif + + if (get(g:, 'airline#extensions#whitespace#enabled', 1) && get(g:, 'airline_detect_whitespace', 1)) + call airline#extensions#whitespace#init() + endif endif if get(g:, 'airline#extensions#readonly#enabled', 1) diff --git a/autoload/airline/extensions/syntastic.vim b/autoload/airline/extensions/syntastic.vim index 3ce1107..ff4e6a6 100644 --- a/autoload/airline/extensions/syntastic.vim +++ b/autoload/airline/extensions/syntastic.vim @@ -1,10 +1,11 @@ " MIT License. Copyright (c) 2013 Bailey Ling. -" vim: ts=2 sts=2 sw=2 fdm=indent +" vim: et ts=2 sts=2 sw=2 function! airline#extensions#syntastic#apply() - let w:airline_section_warning = ' %#warningmsg#%{SyntasticStatuslineFlag()}' + let w:airline_section_warning = ' %{SyntasticStatuslineFlag()}' endfunction function! airline#extensions#syntastic#init(ext) call a:ext.add_statusline_funcref(function('airline#extensions#syntastic#apply')) endfunction + diff --git a/plugin/airline.vim b/plugin/airline.vim index ec15bef..8eea40a 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -56,7 +56,7 @@ call s:check_defined('g:airline_section_gutter', '%=') call s:check_defined('g:airline_section_x', "%{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') -call s:check_defined('g:airline_section_warning', '') +call s:check_defined('g:airline_section_warning', '__') let s:airline_initialized = 0 let s:airline_theme_defined = 0