From a69834f7dc0c890838a2a40cd8dfd96363e7ca9a Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Tue, 13 Dec 2016 21:44:57 +0100 Subject: [PATCH] Make fileformat output truncatable closes #1309 --- autoload/airline/parts.vim | 9 ++++++++- doc/airline.txt | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/autoload/airline/parts.vim b/autoload/airline/parts.vim index f30f2ae1..6496bd98 100644 --- a/autoload/airline/parts.vim +++ b/autoload/airline/parts.vim @@ -88,5 +88,12 @@ function! airline#parts#filetype() endfunction function! airline#parts#ffenc() - return printf('%s%s%s', &fenc, &l:bomb ? '[BOM]' : '', strlen(&ff) > 0 ? '['.&ff.']' : '') + let expected = get(g:, 'airline#parts#ffenc#skip_expected_string', '') + let bomb = &l:bomb ? '[BOM]' : '' + let ff = strlen(&ff) ? '['.&ff.']' : '' + if expected is# &fenc.bomb.ff + return '' + else + return &fenc.bomb.ff + endif endfunction diff --git a/doc/airline.txt b/doc/airline.txt index ee1f7b9c..a098dd91 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -300,6 +300,12 @@ configuration values that you can use. Try setting this to zero, if you notice bleeding color artifacts > let airline#extensions#default#section_use_groupitems = 1 < +* configure the fileformat output + By default, it will display something like 'utf-8[unix]', however, you can + skip displaying it, if the output matches a configured string. To do so, + set > + let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]' +< ------------------------------------- *airline-quickfix* The quickfix extension is a simple built-in extension which determines whether the buffer is a quickfix or location list buffer, and adjusts the