Allow overriding trailing ws regexp per buffer

For example, in a github repository, you might want to allow trailing
double spaces in a file, but not elsewhere
This commit is contained in:
Evan Chen
2021-08-03 21:35:22 -07:00
parent b861f9d248
commit 0f3feca572
2 changed files with 5 additions and 1 deletions

View File

@@ -78,7 +78,8 @@ function! airline#extensions#whitespace#check()
let check = 'trailing'
if index(checks, check) > -1 && index(get(skip_check_ft, &ft, []), check) < 0
try
let regexp = get(g:, 'airline#extensions#whitespace#trailing_regexp', '\s$')
let regexp = get(b:, 'airline_whitespace_trailing_regexp',
\ get(g:, 'airline#extensions#whitespace#trailing_regexp', '\s$'))
let trailing = search(regexp, 'nw')
catch
call airline#util#warning(printf('Whitespace: error occurred evaluating "%s"', regexp))