support undotree, gundo, nerdtree, tagbar

This commit is contained in:
Bailey Ling 2013-07-09 02:52:07 +00:00
parent 6b705b490d
commit 0c394308e4
3 changed files with 32 additions and 18 deletions

View File

@ -114,15 +114,17 @@ function! airline#update_statusline(active)
else
let sl.=' %f'
endif
let sl.='%<%= '.s:get_section('x').' '
let sl.=l:info_sep_color
let sl.=a:active ? g:airline_right_sep : g:airline_right_alt_sep
let sl.=l:info_color
let sl.=' '.s:get_section('y').' '
let sl.=l:mode_sep_color
let sl.=a:active ? g:airline_right_sep : g:airline_right_alt_sep
let sl.=l:mode_color
let sl.=' '.s:get_section('z').' '
if !exists('w:airline_left_only')
let sl.='%<%= '.s:get_section('x').' '
let sl.=l:info_sep_color
let sl.=a:active ? g:airline_right_sep : g:airline_right_alt_sep
let sl.=l:info_color
let sl.=' '.s:get_section('y').' '
let sl.=l:mode_sep_color
let sl.=a:active ? g:airline_right_sep : g:airline_right_alt_sep
let sl.=l:mode_color
let sl.=' '.s:get_section('z').' '
endif
call setwinvar(winnr(), '&statusline', sl)
endfunction

View File

@ -18,20 +18,32 @@ function! s:empty_sections()
endfor
endfunction
function! s:override_left_only(section1, section2)
let w:airline_section_a = a:section1
let w:airline_section_b = a:section2
let w:airline_section_c = ''
let w:airline_left_only = 1
endfunction
function! airline#extensions#apply_window_overrides()
silent! unlet w:airline_left_only
for section in s:sections
silent! unlet w:airline_section_{section}
endfor
if &ft == 'netrw'
let w:airline_section_a = 'netrw'
let w:airline_section_b = '%f'
let w:airline_section_c = ''
let w:airline_section_gutter = ''
let w:airline_section_x = ''
call s:override_left_only('netrw', '%f')
elseif &ft == 'unite'
call s:empty_sections()
let w:airline_section_a = 'Unite'
let w:airline_section_b = unite#get_status_string()
call s:override_left_only('Unite', unite#get_status_string())
elseif &ft == 'nerdtree'
call s:override_left_only('NERD', '')
elseif &ft == 'undotree'
call s:override_left_only('undotree', '')
elseif &ft == 'gundo'
call s:override_left_only('Gundo', '')
elseif &ft == 'diff'
call s:override_left_only('diff', '')
elseif &ft == 'tagbar'
call s:override_left_only('tagbar', '')
endif
endfunction

View File

@ -21,7 +21,7 @@ call s:check_defined('g:airline_linecolumn_prefix', exists('g:airline_powerline_
call s:check_defined('g:airline_paste_symbol', (exists('g:airline_powerline_fonts') ? ' ' : '').'PASTE')
call s:check_defined('g:airline_theme', 'dark')
call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus'])
call s:check_defined('g:airline_exclude_filetypes', ['diff','undotree','gundo','nerdtree','tagbar'])
call s:check_defined('g:airline_exclude_filetypes', [])
call s:check_defined('g:airline_mode_map', {
\ 'n' : 'NORMAL',