From 27089517150e265687d515f80890f0772c5b4a9d Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Tue, 27 Aug 2013 23:22:26 +0000 Subject: [PATCH] place hunks and branch extension into parts. --- autoload/airline/extensions/branch.vim | 2 +- autoload/airline/extensions/hunks.vim | 2 +- plugin/airline.vim | 19 ++++++++++--------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/autoload/airline/extensions/branch.vim b/autoload/airline/extensions/branch.vim index 33a8e60..a746ea6 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_section_b .= '%{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 aa70b8c..66403b1 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_section_b .= '%{airline#extensions#hunks#get_hunks()}' + let g:airline_parts.hunks = '%{airline#extensions#hunks#get_hunks()}' endfunction diff --git a/plugin/airline.vim b/plugin/airline.vim index e06cd19..4a3984e 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -44,6 +44,8 @@ call extend(g:airline_parts, { \ 'paste': '%{airline#parts#paste()}', \ 'readonly': '%#airline_file#%{airline#parts#readonly()}', \ 'ffenc': '%{printf("%s%s",&fenc,strlen(&ff)>0?"[".&ff."]":"")}', + \ 'hunks': '', + \ 'branch': '', \ }, 'keep') call s:check_defined('g:airline_mode_map', {}) @@ -69,15 +71,6 @@ call extend(g:airline_theme_map, { \ '.*solarized.*': 'solarized', \ }, 'keep') -call s:check_defined('g:airline_section_a', (g:airline_parts.mode).(g:airline_parts.paste).(g:airline_parts.iminsert)) -call s:check_defined('g:airline_section_b', '') -call s:check_defined('g:airline_section_c', '%f%m') -call s:check_defined('g:airline_section_gutter', ' '.(g:airline_parts.readonly).'%=') -call s:check_defined('g:airline_section_x', '%{&filetype}') -call s:check_defined('g:airline_section_y', g:airline_parts.ffenc) -call s:check_defined('g:airline_section_z', '%3p%% %{g:airline_symbols.linenr} %3l:%3c') -call s:check_defined('g:airline_section_warning', '__') - let s:airline_initialized = 0 let s:airline_theme_defined = 0 function! s:init() @@ -85,6 +78,14 @@ function! s:init() let s:airline_initialized = 1 call airline#extensions#load() + call s:check_defined('g:airline_section_a', (g:airline_parts.mode).(g:airline_parts.paste).(g:airline_parts.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', '%f%m') + call s:check_defined('g:airline_section_gutter', ' '.(g:airline_parts.readonly).'%=') + call s:check_defined('g:airline_section_x', '%{&filetype}') + call s:check_defined('g:airline_section_y', g:airline_parts.ffenc) + call s:check_defined('g:airline_section_z', '%3p%% %{g:airline_symbols.linenr} %3l:%3c') + call s:check_defined('g:airline_section_warning', '__') let s:airline_theme_defined = exists('g:airline_theme') if s:airline_theme_defined || !airline#switch_matching_theme()