diff --git a/autoload/vundle.vim b/autoload/vundle.vim index dded571d..0b784d53 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -61,6 +61,20 @@ endif " :Plugin command in the vimrc. It is not possible to do this automatically " because when loading the vimrc file no plugins where loaded yet. func! vundle#rc(...) abort + " If this function has already been called and Vim hasn't finished loading, + " that is, we are not sourcing our .vimrc file later on, Vundle is probably + " loading from several sources which can lead to unpredictable results. + if exists('g:vundle_loading') && g:vundle_loading + echoerr 'Vundle is probably loading from several sources. ' . + \ 'This can lead to unpredictable results! ' . + \ 'Please find and remove the duplication.' + endif + + " Set g:vundle_loading only if Vim hasn't finished loading. + if !exists('g:vundle_loaded') || !g:vundle_loaded + let g:vundle_loading = 1 + endif + let g:bundle_dir = len(a:000) > 0 ? expand(a:1, 1) : expand('$HOME/.vim/bundle', 1) let g:updated_bundles = [] let g:vundle_log = [] @@ -81,4 +95,12 @@ func! vundle#end(...) abort call vundle#config#activate_bundles() endf +augroup vundle + au! + + " Tell Vundle it has finished loading and Vim is up and running. + au VimEnter * unlet g:vundle_loading + au VimEnter * let g:vundle_loaded = 1 +augroup END + " vim: set expandtab sts=2 ts=2 sw=2 tw=78 norl: