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').' '
This commit is contained in:
bootleq 2013-08-03 09:42:18 +08:00
parent dcb7196097
commit 5ebb0daf93
1 changed files with 3 additions and 2 deletions

View File

@ -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)