From 7b0d80050ab1ccc33770431cd27b5e5dd769301c Mon Sep 17 00:00:00 2001 From: Davit Samvelyan Date: Sat, 5 Apr 2014 16:41:27 +0500 Subject: [PATCH] Now trailing tabs are also reported, fixed bug when trailings with mixed tabs and spaces were being reported as mixed indents, case when count of spaces at the end of tabbed indentation less then tabstop does not reported as mixed indent anymore. --- autoload/airline/extensions/whitespace.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/autoload/airline/extensions/whitespace.vim b/autoload/airline/extensions/whitespace.vim index e4e1b20..9dd0cd4 100644 --- a/autoload/airline/extensions/whitespace.vim +++ b/autoload/airline/extensions/whitespace.vim @@ -31,12 +31,18 @@ function! airline#extensions#whitespace#check() let trailing = 0 if index(checks, 'trailing') > -1 - let trailing = search(' $', 'nw') + let trailing = search('\s$', 'nw') endif let mixed = 0 if index(checks, 'indent') > -1 - let mixed = search('\v(^\t+ +)|(^ +\t+)', 'nw') + " [] + " Spaces before or between tabs are not allowed + let t_s_t = '(^\t* +\t\s*\S)' + " ( x count) + " Count of spaces at the end of tabs should be less then tabstop value + let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)' + let mixed = search('\v' . t_s_t . '|' . t_l_s, 'nw') endif if trailing != 0 || mixed != 0