From 9c2c0816f5f7abf8dc1baa442a968e4ac5e53d4d Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Sat, 30 Jan 2016 16:47:40 +0100 Subject: [PATCH] some more smaller updates --- autoload/airline/extensions/default.vim | 7 ++++++- doc/airline.txt | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/autoload/airline/extensions/default.vim b/autoload/airline/extensions/default.vim index 9060ec37..2e92b3b0 100644 --- a/autoload/airline/extensions/default.vim +++ b/autoload/airline/extensions/default.vim @@ -6,10 +6,12 @@ let s:section_truncate_width = get(g:, 'airline#extensions#default#section_trunc \ 'x': 60, \ 'y': 88, \ 'z': 45, + \ 'warning': 80, + \ 'error': 80, \ }) let s:layout = get(g:, 'airline#extensions#default#layout', [ \ [ 'a', 'b', 'c' ], - \ [ 'x', 'y', 'z', 'error', 'warning' ] + \ [ 'x', 'y', 'z', 'warning', 'error' ] \ ]) function! s:get_section(winnr, key, ...) @@ -51,6 +53,9 @@ if v:version >= 704 || (v:version >= 703 && has('patch81')) else " older version don't like the use of %(%) function s:add_section(builder, context, key) + if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key))) + return + endif if a:key == 'warning' call a:builder.add_raw('%#airline_warning#'.s:get_section(a:context.winnr, a:key)) elseif a:key == 'error' diff --git a/doc/airline.txt b/doc/airline.txt index 7dfc9eac..5f5f5cbf 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -271,6 +271,8 @@ configuration values that you can use. \ 'x': 60, \ 'y': 88, \ 'z': 45, + \ 'warning': 80, + \ 'error': 80, \ } " Note: set to an empty dictionary to disable truncation.