From b17b37956d73117ff2ddfea01f6accd40b196fd0 Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Tue, 2 Jul 2013 07:00:31 -0400 Subject: [PATCH] implement ability to exclude by match or filetype (#6) --- doc/airline.txt | 12 ++++++++++++ plugin/airline.vim | 22 +++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/doc/airline.txt b/doc/airline.txt index 01ce922a..a74999fc 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -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 diff --git a/plugin/airline.vim b/plugin/airline.vim index ccf1e41e..161d4728 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -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