append to the existing value in case the user defined it.

This commit is contained in:
Bailey Ling 2014-04-20 14:52:06 +00:00
parent 7560204212
commit 81430cbdf6
1 changed files with 6 additions and 6 deletions

View File

@ -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) let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1)
function! s:check_mixed_indent() function! s:check_mixed_indent()
if s:indent_algo == 0 if s:indent_algo == 1
return search('\v(^\t+ +)|(^ +\t+)', 'nw')
else
" [<tab>]<space><tab> " [<tab>]<space><tab>
" spaces before or between tabs are not allowed " spaces before or between tabs are not allowed
let t_s_t = '(^\t* +\t\s*\S)' 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 " count of spaces at the end of tabs should be less then tabstop value
let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)' let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)'
return search('\v' . t_s_t . '|' . t_l_s, 'nw') return search('\v' . t_s_t . '|' . t_l_s, 'nw')
else
return search('\v(^\t+ +)|(^ +\t+)', 'nw')
endif endif
endfunction endfunction
@ -80,12 +80,12 @@ function! airline#extensions#whitespace#toggle()
call airline#extensions#whitespace#init() call airline#extensions#whitespace#init()
let s:enabled = 1 let s:enabled = 1
endif endif
if exists("g:airline#extensions#whitespace#enabled") if exists("g:airline#extensions#whitespace#enabled")
let g:airline#extensions#whitespace#enabled = s:enabled let g:airline#extensions#whitespace#enabled = s:enabled
if s:enabled if s:enabled && match(g:airline_section_warning, '#whitespace#check') < 0
let g:airline_section_warning = airline#section#create(['syntastic', 'eclim', 'whitespace']) let g:airline_section_warning .= airline#section#create(['whitespace'])
call airline#update_statusline() call airline#update_statusline()
call airline#extensions#whitespace#init()
endif endif
endif endif
echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled') echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled')