Merge pull request #478 from davits/mixed_indent

Improvements in whitespace plugin
This commit is contained in:
Bailey Ling 2014-04-05 16:56:02 -04:00
commit 66d0a47f37

View File

@ -31,12 +31,18 @@ function! airline#extensions#whitespace#check()
let trailing = 0 let trailing = 0
if index(checks, 'trailing') > -1 if index(checks, 'trailing') > -1
let trailing = search(' $', 'nw') let trailing = search('\s$', 'nw')
endif endif
let mixed = 0 let mixed = 0
if index(checks, 'indent') > -1 if index(checks, 'indent') > -1
let mixed = search('\v(^\t+ +)|(^ +\t+)', 'nw') " [<tab>]<space><tab>
" Spaces before or between tabs are not allowed
let t_s_t = '(^\t* +\t\s*\S)'
" <tab>(<space> 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 endif
if trailing != 0 || mixed != 0 if trailing != 0 || mixed != 0