convert branch/hunks/bufferline to function names.

This commit is contained in:
Bailey Ling 2013-08-29 00:15:07 +00:00
parent e10b690cdf
commit bdd758dd38
4 changed files with 12 additions and 9 deletions

View File

@ -31,6 +31,6 @@ function! airline#extensions#branch#get_head()
endfunction endfunction
function! airline#extensions#branch#init(ext) 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 endfunction

View File

@ -54,6 +54,6 @@ function! airline#extensions#hunks#get_hunks()
endfunction endfunction
function! airline#extensions#hunks#init(ext) 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 endfunction

View File

@ -2,12 +2,15 @@
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
function! s:get_val(part) function! s:get_val(part)
if has_key(g:airline_parts, a:part)
let val = g:airline_parts[a:part] let val = g:airline_parts[a:part]
if match(val, '%') > -1 if match(val, '%\| ') > -1
return val return val
else else
return '%{function("'.val.'")()}' return '%{'.val.'()}'
endif endif
endif
return a:part
endfunction endfunction
function! airline#util#define_section(key, parts) function! airline#util#define_section(key, parts)

View File

@ -81,8 +81,8 @@ function! s:init()
call airline#extensions#load() call airline#extensions#load()
call airline#util#define_section('a', ['mode', 'paste', 'iminsert']) 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 airline#util#define_section('b', ['hunks', 'branch'])
call s:check_defined('g:airline_section_c', '%<'.(g:airline_parts.file)) 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_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_x', (g:airline_parts.tagbar).'%{&filetype}')
call s:check_defined('g:airline_section_y', g:airline_parts.ffenc) call s:check_defined('g:airline_section_y', g:airline_parts.ffenc)