From 453f4b759fee44465e909e250ddc89725b586922 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Wed, 27 Jan 2016 14:18:28 +0100 Subject: [PATCH] Allow to customize the trailing whitespace regexp Currently, vim-airline uses hard-coded '\s$' to check for trailing whitespace. However you might want to check for different values. Therefore, set the variable g:airline#extensions#whitespace#trailing_regexp to the required regexp value. closes #663 --- autoload/airline/extensions/whitespace.vim | 9 ++++++++- doc/airline.txt | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/autoload/airline/extensions/whitespace.vim b/autoload/airline/extensions/whitespace.vim index cb5e846..6370c46 100644 --- a/autoload/airline/extensions/whitespace.vim +++ b/autoload/airline/extensions/whitespace.vim @@ -49,7 +49,14 @@ function! airline#extensions#whitespace#check() let trailing = 0 if index(checks, 'trailing') > -1 - let trailing = search('\s$', 'nw') + try + let regexp = get(g:, 'airline#extensions#whitespace#trailing_regexp', '\s$') + let trailing = search(regexp, 'nw') + catch + echomsg 'airline#whitespace: error occured evaluating '. regexp + echomsg v:exception + return '' + endtry endif let mixed = 0 diff --git a/doc/airline.txt b/doc/airline.txt index 4ed0919..8731f42 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -449,6 +449,9 @@ eclim let g:airline#extensions#whitespace#trailing_format = 'trailing[%s]' let g:airline#extensions#whitespace#mixed_indent_format = 'mixed-indent[%s]' let g:airline#extensions#whitespace#long_format = 'long[%s]' + +* configure custom trailing whitespace regexp rule > + let g:airline#extensions#whitespace#trailing_regexp = '\s$' < ------------------------------------- *airline-tabline* * enable/disable enhanced tabline. >