fix regressions introduced from recent init changes. resolves #721.

This commit is contained in:
Bailey Ling 2015-03-03 22:07:23 -05:00
parent 77c58de628
commit 1b8e4b965a
1 changed files with 15 additions and 4 deletions

View File

@ -6,8 +6,14 @@ if &cp || v:version < 702 || (exists('g:loaded_airline') && g:loaded_airline)
endif endif
let g:loaded_airline = 1 let g:loaded_airline = 1
let s:airline_initialized = 0
let s:airline_theme_defined = 0 let s:airline_theme_defined = 0
function! s:init() function! s:init()
if s:airline_initialized
return
endif
let s:airline_initialized = 1
call airline#extensions#load() call airline#extensions#load()
call airline#init#sections() call airline#init#sections()
@ -18,17 +24,18 @@ function! s:init()
endif endif
silent doautocmd User AirlineAfterInit silent doautocmd User AirlineAfterInit
call s:airline_toggle()
endfunction endfunction
function! s:on_window_changed() function! s:on_window_changed()
if pumvisible() if pumvisible()
return return
endif endif
call s:init()
call airline#update_statusline() call airline#update_statusline()
endfunction endfunction
function! s:on_colorscheme_changed() function! s:on_colorscheme_changed()
call s:init()
if !s:airline_theme_defined if !s:airline_theme_defined
if airline#switch_matching_theme() if airline#switch_matching_theme()
return return
@ -74,7 +81,10 @@ function! s:airline_toggle()
\ | call airline#load_theme() \ | call airline#load_theme()
augroup END augroup END
call <sid>on_window_changed() if s:airline_initialized
call s:on_window_changed()
endif
silent doautocmd User AirlineToggledOn silent doautocmd User AirlineToggledOn
endif endif
endfunction endfunction
@ -94,10 +104,11 @@ endfunction
command! -nargs=? -complete=customlist,<sid>get_airline_themes AirlineTheme call <sid>airline_theme(<f-args>) command! -nargs=? -complete=customlist,<sid>get_airline_themes AirlineTheme call <sid>airline_theme(<f-args>)
command! AirlineToggleWhitespace call airline#extensions#whitespace#toggle() command! AirlineToggleWhitespace call airline#extensions#whitespace#toggle()
command! AirlineToggle call <sid>airline_toggle() command! AirlineToggle call s:airline_toggle()
command! AirlineRefresh call airline#load_theme() | call airline#update_statusline() command! AirlineRefresh call airline#load_theme() | call airline#update_statusline()
call airline#init#bootstrap() call airline#init#bootstrap()
call s:airline_toggle()
autocmd VimEnter * call airline#deprecation#check() autocmd VimEnter * call airline#deprecation#check()
autocmd VimEnter * call s:init()