add netrw support. resolves #31.

This commit is contained in:
Bailey Ling 2013-07-09 00:51:33 +00:00
parent 43bc51a0d2
commit e0c74f9a1e
3 changed files with 33 additions and 10 deletions

View File

@ -67,6 +67,8 @@ function! s:apply_window_overrides()
let w:airline_section_b = ''
let w:airline_section_c = bufname(winbufnr(winnr()))
endif
call airline#extensions#apply_window_overrides()
endfunction
function! airline#update_externals()
@ -106,13 +108,13 @@ function! airline#update_statusline(active)
let sl.=l:info_sep_color
let sl.=g:airline_left_sep
let sl.=l:status_color.' '.s:get_section('c').' '
let sl.=s:get_section('gutter') != ''
let sl.=exists('w:airline_section_gutter')
\ ? s:get_section('gutter')
\ : '%#warningmsg#'.g:airline_externals_syntastic.l:status_color."%<%=".l:file_flag_color."%{&ro ? g:airline_readonly_symbol : ''}".l:status_color
\ : '%#warningmsg#'.g:airline_externals_syntastic.l:file_flag_color."%{&ro ? g:airline_readonly_symbol : ''}".l:status_color
else
let sl.=' %f%<%='
let sl.=' %f'
endif
let sl.=' '.s:get_section('x').' '
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

View File

@ -1,10 +1,7 @@
let s:sections = ['a','b','c','gutter','x','y','z']
function! airline#extensions#load()
let g:unite_force_overwrite_statusline = 0
autocmd FileType unite
\ let w:airline_section_a = 'Unite'
\ | let w:airline_section_b = unite#get_status_string()
\ | call airline#update_statusline(1)
\ | unlet w:airline_section_a | unlet w:airline_section_b
if exists('g:loaded_ctrlp') && g:loaded_ctrlp
call airline#extensions#ctrlp#load_ctrlp_hi()
@ -14,3 +11,27 @@ function! airline#extensions#load()
\ }
endif
endfunction
function! s:empty_sections()
for section in s:sections
let w:airline_section_{section} = ''
endfor
endfunction
function! airline#extensions#apply_window_overrides()
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 = ''
elseif &ft == 'unite'
call s:empty_sections()
let w:airline_section_a = 'Unite'
let w:airline_section_b = unite#get_status_string()
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', ['netrw','diff','undotree','gundo','nerdtree','tagbar'])
call s:check_defined('g:airline_exclude_filetypes', ['diff','undotree','gundo','nerdtree','tagbar'])
call s:check_defined('g:airline_mode_map', {
\ 'n' : 'NORMAL',