From 1b8e4b965adc97af623bf71c046c7d7408aba725 Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Tue, 3 Mar 2015 22:07:23 -0500 Subject: [PATCH] fix regressions introduced from recent init changes. resolves #721. --- plugin/airline.vim | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/plugin/airline.vim b/plugin/airline.vim index 6b140e2..5667047 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -6,8 +6,14 @@ if &cp || v:version < 702 || (exists('g:loaded_airline') && g:loaded_airline) endif let g:loaded_airline = 1 +let s:airline_initialized = 0 let s:airline_theme_defined = 0 function! s:init() + if s:airline_initialized + return + endif + let s:airline_initialized = 1 + call airline#extensions#load() call airline#init#sections() @@ -18,17 +24,18 @@ function! s:init() endif silent doautocmd User AirlineAfterInit - call s:airline_toggle() endfunction function! s:on_window_changed() if pumvisible() return endif + call s:init() call airline#update_statusline() endfunction function! s:on_colorscheme_changed() + call s:init() if !s:airline_theme_defined if airline#switch_matching_theme() return @@ -74,7 +81,10 @@ function! s:airline_toggle() \ | call airline#load_theme() augroup END - call on_window_changed() + if s:airline_initialized + call s:on_window_changed() + endif + silent doautocmd User AirlineToggledOn endif endfunction @@ -94,10 +104,11 @@ endfunction command! -nargs=? -complete=customlist,get_airline_themes AirlineTheme call airline_theme() command! AirlineToggleWhitespace call airline#extensions#whitespace#toggle() -command! AirlineToggle call airline_toggle() +command! AirlineToggle call s:airline_toggle() command! AirlineRefresh call airline#load_theme() | call airline#update_statusline() call airline#init#bootstrap() +call s:airline_toggle() autocmd VimEnter * call airline#deprecation#check() -autocmd VimEnter * call s:init() +