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
No known key found for this signature in database
GPG Key ID: 9474E9565D64C443
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))

View File

@ -1558,6 +1558,9 @@ vista.vim <https://github.com/liuchengxu/vista.vim>
* configure custom trailing whitespace regexp rule >
let g:airline#extensions#whitespace#trailing_regexp = '\s$'
" this can also be configured for an individual buffer
let b:airline_whitespace_trailing_regexp = '\s$'
* configure, which filetypes have special treatment of /* */ comments,
matters for mix-indent-file algorithm: >
let airline#extensions#c_like_langs =