make the separator optional for older vim versions. resolves #239.
This commit is contained in:
parent
55f524de77
commit
bed11010ba
|
@ -28,19 +28,33 @@ function! s:build_sections(builder, context, keys)
|
||||||
if key == 'warning' && !a:context.active
|
if key == 'warning' && !a:context.active
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
call s:add_section(a:builder, a:context, key)
|
||||||
" i have no idea why the warning section needs special treatment, but it's
|
|
||||||
" needed to prevent separators from showing up
|
|
||||||
if key == 'warning'
|
|
||||||
call a:builder.add_raw('%(')
|
|
||||||
endif
|
|
||||||
call a:builder.add_section('airline_'.key, s:get_section(a:context.winnr, key))
|
|
||||||
if key == 'warning'
|
|
||||||
call a:builder.add_raw('%)')
|
|
||||||
endif
|
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
if v:version >= 704 || (v:version >= 703 && has('patch81'))
|
||||||
|
function s:add_section(builder, context, key)
|
||||||
|
" i have no idea why the warning section needs special treatment, but it's
|
||||||
|
" needed to prevent separators from showing up
|
||||||
|
if a:key == 'warning'
|
||||||
|
call a:builder.add_raw('%(')
|
||||||
|
endif
|
||||||
|
call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key))
|
||||||
|
if a:key == 'warning'
|
||||||
|
call a:builder.add_raw('%)')
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
" older version don't like the use of %(%)
|
||||||
|
function s:add_section(builder, context, key)
|
||||||
|
if a:key == 'warning'
|
||||||
|
call a:builder.add_raw('%#airline_warning#'.s:get_section(a:context.winnr, a:key))
|
||||||
|
else
|
||||||
|
call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key))
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
function! airline#extensions#default#apply(builder, context)
|
function! airline#extensions#default#apply(builder, context)
|
||||||
let winnr = a:context.winnr
|
let winnr = a:context.winnr
|
||||||
let active = a:context.active
|
let active = a:context.active
|
||||||
|
|
Loading…
Reference in New Issue