From 5ebb0daf937d0617dbabaa0825ac3a29f17a824b Mon Sep 17 00:00:00 2001 From: bootleq Date: Sat, 3 Aug 2013 09:42:18 +0800 Subject: [PATCH] Add prefix/suffix options for s:get_section. For output format other than default 1 space padding. Need this to keep original section_c style: let sl.=l:status_color.' %<'.s:get_section(a:winnr, 'c').' ' --- autoload/airline.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/autoload/airline.vim b/autoload/airline.vim index 09e800a..7e60706 100644 --- a/autoload/airline.vim +++ b/autoload/airline.vim @@ -93,9 +93,10 @@ function! s:getwinvar(winnr, key, ...) return get(winvals, a:key, (a:0 ? a:1 : '')) endfunction -function! s:get_section(winnr, key) +function! s:get_section(winnr, key, ...) let text = s:getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key}) - return empty(text) ? '' : ' '.text.' ' + let [prefix, suffix] = [get(a:000, 0, ' '), get(a:000, 1, ' ')] + return empty(text) ? '' : prefix.text.suffix endfunction function! s:get_statusline(winnr, active)