From 81430cbdf66c9e14aac3c4cfa80e5b68c637c7b4 Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Sun, 20 Apr 2014 14:52:06 +0000 Subject: [PATCH] append to the existing value in case the user defined it. --- autoload/airline/extensions/whitespace.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/autoload/airline/extensions/whitespace.vim b/autoload/airline/extensions/whitespace.vim index 10d14065..86574129 100644 --- a/autoload/airline/extensions/whitespace.vim +++ b/autoload/airline/extensions/whitespace.vim @@ -22,9 +22,7 @@ let s:max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000) let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1) function! s:check_mixed_indent() - if s:indent_algo == 0 - return search('\v(^\t+ +)|(^ +\t+)', 'nw') - else + if s:indent_algo == 1 " [] " spaces before or between tabs are not allowed let t_s_t = '(^\t* +\t\s*\S)' @@ -32,6 +30,8 @@ function! s:check_mixed_indent() " count of spaces at the end of tabs should be less then tabstop value let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)' return search('\v' . t_s_t . '|' . t_l_s, 'nw') + else + return search('\v(^\t+ +)|(^ +\t+)', 'nw') endif endfunction @@ -80,12 +80,12 @@ function! airline#extensions#whitespace#toggle() call airline#extensions#whitespace#init() let s:enabled = 1 endif + if exists("g:airline#extensions#whitespace#enabled") let g:airline#extensions#whitespace#enabled = s:enabled - if s:enabled - let g:airline_section_warning = airline#section#create(['syntastic', 'eclim', 'whitespace']) + if s:enabled && match(g:airline_section_warning, '#whitespace#check') < 0 + let g:airline_section_warning .= airline#section#create(['whitespace']) call airline#update_statusline() - call airline#extensions#whitespace#init() endif endif echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled')