From d99112d6c6566e0a7db3c480c251458c7bdb9c33 Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Sun, 9 Mar 2014 21:56:36 -0400 Subject: [PATCH] improve whitespace detection. resolves #452. --- autoload/airline/extensions/whitespace.vim | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/autoload/airline/extensions/whitespace.vim b/autoload/airline/extensions/whitespace.vim index ba98b71..e4e1b20 100644 --- a/autoload/airline/extensions/whitespace.vim +++ b/autoload/airline/extensions/whitespace.vim @@ -36,19 +36,17 @@ function! airline#extensions#whitespace#check() let mixed = 0 if index(checks, 'indent') > -1 - let indents = [search('^ \{2,}', 'nb'), search('^ \{2,}', 'n'), search('^\t', 'nb'), search('^\t', 'n')] - let mixed = indents[0] != 0 && indents[1] != 0 && indents[2] != 0 && indents[3] != 0 + let mixed = search('\v(^\t+ +)|(^ +\t+)', 'nw') endif - if trailing != 0 || mixed + if trailing != 0 || mixed != 0 let b:airline_whitespace_check = s:symbol if s:show_message if trailing != 0 let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:trailing_format, trailing) endif - if mixed - let mixnr = indents[0] == indents[1] ? indents[0] : indents[2] - let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixnr) + if mixed != 0 + let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixed) endif endif endif