From 358d4328f439bfe3181b1eb2598af6400ab85ed8 Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Mon, 26 Aug 2013 02:08:04 +0000 Subject: [PATCH] support formattable whitespace messages. resolves #185. --- autoload/airline/extensions/whitespace.vim | 7 +++++-- doc/airline.txt | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/autoload/airline/extensions/whitespace.vim b/autoload/airline/extensions/whitespace.vim index 414c5968..4cf7fafa 100644 --- a/autoload/airline/extensions/whitespace.vim +++ b/autoload/airline/extensions/whitespace.vim @@ -15,6 +15,9 @@ let s:symbol = get(g:, 'airline#extensions#whitespace#symbol', let s:checks = get(g:, 'airline#extensions#whitespace#checks', ['indent', 'trailing']) +let s:trailing_format = get(g:, 'airline#extensions#whitespace#trailing_format', 'trailing[%s]') +let s:mixed_indent_format = get(g:, 'airline#extensions#whitespace#mixed_indent_format', 'mixed-indent[%s]') + let s:initialized = 0 let s:enabled = 1 @@ -41,11 +44,11 @@ function! airline#extensions#whitespace#check() let b:airline_whitespace_check = s:symbol." " if s:show_message if trailing != 0 - let b:airline_whitespace_check .= 'trailing['.trailing.'] ' + let b:airline_whitespace_check .= printf(s:trailing_format, trailing).' ' endif if mixed let mixnr = indents[0] == indents[1] ? indents[0] : indents[2] - let b:airline_whitespace_check .= 'mixed-indent['.mixnr.'] ' + let b:airline_whitespace_check .= printf(s:mixed_indent_format, mixnr).' ' endif endif endif diff --git a/doc/airline.txt b/doc/airline.txt index 21fb6544..51c193d7 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -242,6 +242,10 @@ vim-signify < * configure whether a message should be displayed. > let g:airline#extensions#whitespace#show_message = 1 +< +* configure the formatting of the warning messages. > + let g:airline#extensions#whitespace#trailing_format = 'trailing[%s]' + let g:airline#extensions#whitespace#mixed_indent_format = 'mixed-indent[%s]' < *airline-ctrlp* ctrlp