account for plugins which use eventignore. resolves #82.

This commit is contained in:
Bailey Ling 2013-07-31 17:37:00 +00:00
parent d56b9bbfcd
commit d107c4fd5d
1 changed files with 13 additions and 2 deletions

View File

@ -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,<sid>get_airline_themes AirlineTheme call
augroup airline
au!
autocmd ColorScheme * call airline#highlight(['normal'])
autocmd WinEnter,BufWinEnter,FileType,BufUnload * call <sid>init() | call airline#update_statusline()
autocmd WinEnter,BufWinEnter,FileType,BufUnload * call <sid>on_window_changed()
autocmd ShellCmdPost * call airline#update_externals()
autocmd CursorMoved * call <sid>sync_active_winnr()
augroup END