Merge pull request #973 from chrisbra/airline_error

some more smaller updates
This commit is contained in:
Christian Brabandt 2016-01-30 21:02:24 +01:00
commit c34b29beb4
2 changed files with 8 additions and 1 deletions

View File

@ -6,10 +6,12 @@ let s:section_truncate_width = get(g:, 'airline#extensions#default#section_trunc
\ 'x': 60, \ 'x': 60,
\ 'y': 88, \ 'y': 88,
\ 'z': 45, \ 'z': 45,
\ 'warning': 80,
\ 'error': 80,
\ }) \ })
let s:layout = get(g:, 'airline#extensions#default#layout', [ let s:layout = get(g:, 'airline#extensions#default#layout', [
\ [ 'a', 'b', 'c' ], \ [ 'a', 'b', 'c' ],
\ [ 'x', 'y', 'z', 'error', 'warning' ] \ [ 'x', 'y', 'z', 'warning', 'error' ]
\ ]) \ ])
function! s:get_section(winnr, key, ...) function! s:get_section(winnr, key, ...)
@ -51,6 +53,9 @@ if v:version >= 704 || (v:version >= 703 && has('patch81'))
else else
" older version don't like the use of %(%) " older version don't like the use of %(%)
function s:add_section(builder, context, key) 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' if a:key == 'warning'
call a:builder.add_raw('%#airline_warning#'.s:get_section(a:context.winnr, a:key)) call a:builder.add_raw('%#airline_warning#'.s:get_section(a:context.winnr, a:key))
elseif a:key == 'error' elseif a:key == 'error'

View File

@ -271,6 +271,8 @@ configuration values that you can use.
\ 'x': 60, \ 'x': 60,
\ 'y': 88, \ 'y': 88,
\ 'z': 45, \ 'z': 45,
\ 'warning': 80,
\ 'error': 80,
\ } \ }
" Note: set to an empty dictionary to disable truncation. " Note: set to an empty dictionary to disable truncation.