From 30adb973fcba2fba20e34fe910dfa958e52486ea Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Fri, 16 Aug 2013 01:50:24 +0000 Subject: [PATCH] move getwinvar over --- autoload/airline.vim | 12 +++--------- autoload/airline/util.vim | 6 ++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/autoload/airline.vim b/autoload/airline.vim index 8be602cd..53d0d05c 100644 --- a/autoload/airline.vim +++ b/autoload/airline.vim @@ -61,14 +61,8 @@ function! airline#highlight(modes) endfor endfunction -" for 7.2 compatibility -function! s:getwinvar(winnr, key, ...) - let winvals = getwinvar(a:winnr, '') - return get(winvals, a:key, (a:0 ? a:1 : '')) -endfunction - function! s:get_section(winnr, key, ...) - let text = s:getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key}) + let text = airline#util#getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key}) let [prefix, suffix] = [get(a:000, 0, '%( '), get(a:000, 1, ' %)')] return empty(text) ? '' : prefix.text.suffix endfunction @@ -76,7 +70,7 @@ endfunction function! airline#get_statusline(winnr, active) let builder = airline#builder#new(a:active) - if s:getwinvar(a:winnr, 'airline_render_left', a:active || (!a:active && !g:airline_inactive_collapse)) + if airline#util#getwinvar(a:winnr, 'airline_render_left', a:active || (!a:active && !g:airline_inactive_collapse)) call builder.add_section('Al2', s:get_section(a:winnr, 'a').'%{g:airline_detect_paste && &paste ? g:airline_paste_symbol." " : ""}') call builder.add_section('Al4', s:get_section(a:winnr, 'b')) call builder.add_section('Al6', s:get_section(a:winnr, 'c').' %#Al7#%{&ro ? g:airline_readonly_symbol : ""}') @@ -84,7 +78,7 @@ function! airline#get_statusline(winnr, active) call builder.add_section('Al6', '%f%m') endif call builder.split(s:get_section(a:winnr, 'gutter', '', '')) - if s:getwinvar(a:winnr, 'airline_render_right', 1) + if airline#util#getwinvar(a:winnr, 'airline_render_right', 1) call builder.add_section('Al6', s:get_section(a:winnr, 'x')) call builder.add_section('Al4', s:get_section(a:winnr, 'y')) call builder.add_section('Al2', s:get_section(a:winnr, 'z')) diff --git a/autoload/airline/util.vim b/autoload/airline/util.vim index b40b34a2..8372d99d 100644 --- a/autoload/airline/util.vim +++ b/autoload/airline/util.vim @@ -1,6 +1,12 @@ " MIT license. Copyright (c) 2013 Bailey Ling. " vim: ts=2 sts=2 sw=2 fdm=indent +" for 7.2 compatibility +function! airline#util#getwinvar(winnr, key, ...) + let winvals = getwinvar(a:winnr, '') + return get(winvals, a:key, (a:0 ? a:1 : '')) +endfunction + function! airline#util#exec_funcrefs(list, break_early) " for 7.2; we cannot iterate list, hence why we use range() " for 7.3-[97, 328]; we cannot reuse the variable, hence the {}