diff --git a/doc/airline.txt b/doc/airline.txt index 18b635d4..c9999581 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -2080,6 +2080,11 @@ Q. Performance is bad A. Check the question at the wiki: https://github.com/vim-airline/vim-airline/wiki/FAQ#i-have-a-performance-problem +Q. Something strange happens on certain autocommands +A. Try to disable the autocommand by setting the 'eventignore' option like + this: > + set eventignore+=FocusGained + Solutions to other common problems can be found in the Wiki: diff --git a/plugin/airline.vim b/plugin/airline.vim index 640d8b6e..e2d0d286 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -75,6 +75,10 @@ function! s:on_window_changed(event) endfunction function! s:on_focus_gained() + if &eventignore =~? 'focusgained' + return + endif + if airline#util#try_focusgained() unlet! w:airline_lastmode | :call airline_refresh(1) endif @@ -148,7 +152,7 @@ function! s:airline_toggle() autocmd CursorMoved * call on_cursor_moved() autocmd VimResized * call on_focus_gained() - if exists('*timer_start') && exists('*funcref') + if exists('*timer_start') && exists('*funcref') && &eventignore !~? 'focusgained' " do not trigger FocusGained on startup, it might erase the intro screen (see #1817) " needs funcref() (needs 7.4.2137) and timers (7.4.1578) let Handler=funcref('FocusGainedHandler') @@ -234,7 +238,7 @@ function! s:airline_refresh(...) endfunction function! s:FocusGainedHandler(timer) - if exists("s:timer") && a:timer == s:timer && exists('#airline') + if exists("s:timer") && a:timer == s:timer && exists('#airline') && &eventignore !~? 'focusgained' augroup airline au FocusGained * call s:on_focus_gained() augroup END