From d107c4fd5dd320dea8482cddaacc8b4b30fa0ad9 Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Wed, 31 Jul 2013 17:37:00 +0000 Subject: [PATCH] account for plugins which use eventignore. resolves #82. --- plugin/airline.vim | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plugin/airline.vim b/plugin/airline.vim index 5689caf3..ea45e52c 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -43,7 +43,9 @@ call s:check_defined('g:airline_mode_map', { \ }) let s:airline_initialized = 0 -function! s:init() +let s:active_winnr = -1 +function! s:on_window_changed() + let s:active_winnr = winnr() if !s:airline_initialized call airline#extensions#load() call airline#update_externals() @@ -57,6 +59,14 @@ function! s:init() call s:check_defined('g:airline_section_z', '%3p%% '.g:airline_linecolumn_prefix.'%3l:%3c') let s:airline_initialized = 1 endif + call airline#update_statusline() +endfunction + +" non-trivial number of external plugins use eventignore=all, so we need to account for that +function! s:sync_active_winnr() + if winnr() != s:active_winnr + call airline#update_statusline() + endif endfunction function! s:get_airline_themes(a, l, p) @@ -75,6 +85,7 @@ command! -nargs=? -complete=customlist,get_airline_themes AirlineTheme call augroup airline au! autocmd ColorScheme * call airline#highlight(['normal']) - autocmd WinEnter,BufWinEnter,FileType,BufUnload * call init() | call airline#update_statusline() + autocmd WinEnter,BufWinEnter,FileType,BufUnload * call on_window_changed() autocmd ShellCmdPost * call airline#update_externals() + autocmd CursorMoved * call sync_active_winnr() augroup END