implement ability to exclude by match or filetype (#6)

This commit is contained in:
Bailey Ling 2013-07-02 07:00:31 -04:00
parent a643015676
commit b17b37956d
2 changed files with 33 additions and 1 deletions

View File

@ -65,6 +65,17 @@ values):
let g:airline_powerline_fonts=0
<
* define the set of match queries which excludes a window from having its
statusline modified
>
let g:airline_exclude_windows = [] " see source for current list
<
* define the set of filetypes which are excluded from having its window
statusline modified
>
let g:airline_exclude_filetypes = [] " see source for current list
<
==============================================================================
CUSTOMIZATION *airline-customization*
@ -79,6 +90,7 @@ well as the powerline font glyths
let g:airline_right_sep = '◀'
let g:airline_linecolumn_prefix = '␊ '
let g:airline_linecolumn_prefix = '␤ '
let g:airline_linecolumn_prefix = '¶ '
let g:airline_fugitive_prefix = '⎇ '
" powerline symbols

View File

@ -30,6 +30,12 @@ endif
if !exists('g:airline_modified_detection')
let g:airline_modified_detection=1
endif
if !exists('g:airline_exclude_windows')
let g:airline_exclude_windows = ['DebuggerWatch','DebuggerStack','DebuggerStatus']
endif
if !exists('g:airline_exclude_filetypes')
let g:airline_exclude_filetypes = ['qf','netrw','diff','undotree','gundo','nerdtree','tagbar']
endif
set laststatus=2
@ -82,8 +88,22 @@ function! s:highlight(mode, keys)
endfor
endfunction
function! s:is_excluded_window()
for matchft in g:airline_exclude_filetypes
if matchft ==# &ft
return 1
endif
endfor
for matchw in g:airline_exclude_windows
if matchstr(expand('%'), matchw) ==# matchw
return 1
endif
endfor
return 0
endfunction
function! s:update_statusline(active)
if &ft == 'qf' || matchstr(expand('%'), 'NERD') ==# 'NERD' || matchstr(expand('%'), 'Tagbar') ==# 'Tagbar'
if s:is_excluded_window()
return
endif