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 else
let sl.=' %f' let sl.=' %f'
endif endif
let sl.='%<%= '.s:get_section('x').' ' if !exists('w:airline_left_only')
let sl.=l:info_sep_color let sl.='%<%= '.s:get_section('x').' '
let sl.=a:active ? g:airline_right_sep : g:airline_right_alt_sep let sl.=l:info_sep_color
let sl.=l:info_color let sl.=a:active ? g:airline_right_sep : g:airline_right_alt_sep
let sl.=' '.s:get_section('y').' ' let sl.=l:info_color
let sl.=l:mode_sep_color let sl.=' '.s:get_section('y').' '
let sl.=a:active ? g:airline_right_sep : g:airline_right_alt_sep let sl.=l:mode_sep_color
let sl.=l:mode_color let sl.=a:active ? g:airline_right_sep : g:airline_right_alt_sep
let sl.=' '.s:get_section('z').' ' let sl.=l:mode_color
let sl.=' '.s:get_section('z').' '
endif
call setwinvar(winnr(), '&statusline', sl) call setwinvar(winnr(), '&statusline', sl)
endfunction endfunction

View File

@ -18,20 +18,32 @@ function! s:empty_sections()
endfor endfor
endfunction 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() function! airline#extensions#apply_window_overrides()
silent! unlet w:airline_left_only
for section in s:sections for section in s:sections
silent! unlet w:airline_section_{section} silent! unlet w:airline_section_{section}
endfor endfor
if &ft == 'netrw' if &ft == 'netrw'
let w:airline_section_a = 'netrw' call s:override_left_only('netrw', '%f')
let w:airline_section_b = '%f'
let w:airline_section_c = ''
let w:airline_section_gutter = ''
let w:airline_section_x = ''
elseif &ft == 'unite' elseif &ft == 'unite'
call s:empty_sections() call s:override_left_only('Unite', unite#get_status_string())
let w:airline_section_a = 'Unite' elseif &ft == 'nerdtree'
let w:airline_section_b = unite#get_status_string() 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 endif
endfunction 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_paste_symbol', (exists('g:airline_powerline_fonts') ? ' ' : '').'PASTE')
call s:check_defined('g:airline_theme', 'dark') 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_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', { call s:check_defined('g:airline_mode_map', {
\ 'n' : 'NORMAL', \ 'n' : 'NORMAL',