From e395afed519919a870bbb930152c3bf6b8305c68 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Fri, 13 Dec 2019 08:55:56 +0100 Subject: [PATCH] vista: init extension on VimEnter closes #2009 --- autoload/airline/extensions.vim | 1 + autoload/airline/extensions/vista.vim | 2 +- plugin/airline.vim | 10 +++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/autoload/airline/extensions.vim b/autoload/airline/extensions.vim index 1d62b617..c79cded2 100644 --- a/autoload/airline/extensions.vim +++ b/autoload/airline/extensions.vim @@ -232,6 +232,7 @@ function! airline#extensions#load() endif if get(g:, 'airline#extensions#vista#enabled', 1) + \ && exists(':Vista') call airline#extensions#vista#init(s:ext) call add(s:loaded_ext, 'vista') endif diff --git a/autoload/airline/extensions/vista.vim b/autoload/airline/extensions/vista.vim index d17399d6..2ea46c20 100644 --- a/autoload/airline/extensions/vista.vim +++ b/autoload/airline/extensions/vista.vim @@ -1,5 +1,5 @@ " MIT License. Copyright (c) 2019 s1341 (github@shmarya.net) -" Plugin: https://github.com/liuchngxu/vista.vim +" Plugin: https://github.com/liuchengxu/vista.vim " vim: et ts=2 sts=2 sw=2 scriptencoding utf-8 diff --git a/plugin/airline.vim b/plugin/airline.vim index 1e9b25bb..0fded917 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -44,6 +44,14 @@ function! s:init() call airline#util#doautocmd('AirlineAfterInit') endfunction +function! s:do_vim_enter() + " Needed for the Vista extension #2009 + if get(g:, 'airline#extensions#vista#enabled', 1) && exists(':Vista') + call vista#RunForNearestMethodOrFunction() + endif + call on_window_changed('VimEnter') +endfunction + let s:active_winnr = -1 function! s:on_window_changed(event) " don't trigger for Vim popup windows @@ -132,7 +140,7 @@ function! s:airline_toggle() " Refresh airline for :syntax off autocmd SourcePre */syntax/syntax.vim \ call airline#extensions#tabline#buffers#invalidate() - autocmd VimEnter * call on_window_changed('VimEnter') + autocmd VimEnter * call do_vim_enter() autocmd WinEnter * call on_window_changed('WinEnter') autocmd FileType * call on_window_changed('FileType') autocmd BufWinEnter * call on_window_changed('BufWinEnter')