From bdd758dd3885fcc5a5bf5eed49dc1a196d2a54ac Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Thu, 29 Aug 2013 00:15:07 +0000 Subject: [PATCH] convert branch/hunks/bufferline to function names. --- autoload/airline/extensions/branch.vim | 2 +- autoload/airline/extensions/hunks.vim | 2 +- autoload/airline/util.vim | 13 ++++++++----- plugin/airline.vim | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/autoload/airline/extensions/branch.vim b/autoload/airline/extensions/branch.vim index a746ea6..14dc8af 100644 --- a/autoload/airline/extensions/branch.vim +++ b/autoload/airline/extensions/branch.vim @@ -31,6 +31,6 @@ function! airline#extensions#branch#get_head() endfunction function! airline#extensions#branch#init(ext) - let g:airline_parts.branch = '%{airline#extensions#branch#get_head()}' + let g:airline_parts.branch = 'airline#extensions#branch#get_head' endfunction diff --git a/autoload/airline/extensions/hunks.vim b/autoload/airline/extensions/hunks.vim index 66403b1..0c5ee50 100644 --- a/autoload/airline/extensions/hunks.vim +++ b/autoload/airline/extensions/hunks.vim @@ -54,6 +54,6 @@ function! airline#extensions#hunks#get_hunks() endfunction function! airline#extensions#hunks#init(ext) - let g:airline_parts.hunks = '%{airline#extensions#hunks#get_hunks()}' + let g:airline_parts.hunks = 'airline#extensions#hunks#get_hunks' endfunction diff --git a/autoload/airline/util.vim b/autoload/airline/util.vim index e556024..624e5e8 100644 --- a/autoload/airline/util.vim +++ b/autoload/airline/util.vim @@ -2,12 +2,15 @@ " vim: et ts=2 sts=2 sw=2 function! s:get_val(part) - let val = g:airline_parts[a:part] - if match(val, '%') > -1 - return val - else - return '%{function("'.val.'")()}' + if has_key(g:airline_parts, a:part) + let val = g:airline_parts[a:part] + if match(val, '%\| ') > -1 + return val + else + return '%{'.val.'()}' + endif endif + return a:part endfunction function! airline#util#define_section(key, parts) diff --git a/plugin/airline.vim b/plugin/airline.vim index 341a8a7..e5b812b 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -81,8 +81,8 @@ function! s:init() call airline#extensions#load() call airline#util#define_section('a', ['mode', 'paste', 'iminsert']) - call s:check_defined('g:airline_section_b', (g:airline_parts.hunks).(g:airline_parts.branch)) - call s:check_defined('g:airline_section_c', '%<'.(g:airline_parts.file)) + call airline#util#define_section('b', ['hunks', 'branch']) + call airline#util#define_section('c', ['%<', 'file']) call s:check_defined('g:airline_section_gutter', ' '.(g:airline_parts.readonly).'%=') call s:check_defined('g:airline_section_x', (g:airline_parts.tagbar).'%{&filetype}') call s:check_defined('g:airline_section_y', g:airline_parts.ffenc)