From e4a11a2ffe4a318ed486ef78978d9bb00ee4eeb3 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Sat, 28 Nov 2020 17:16:11 +0000 Subject: [PATCH] Fix package load init order bugs * Move calls to `minpac#init()` into commands which use minpac * Check if optional package directories exist before using `packadd` --- plugin/commands.vim | 6 +++--- vimrc | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/plugin/commands.vim b/plugin/commands.vim index 2fc7fd2..8e27a0c 100644 --- a/plugin/commands.vim +++ b/plugin/commands.vim @@ -1,10 +1,10 @@ " minpac command! PackUpdate packadd minpac | source $MYVIMRC | - \ call minpac#update('', {'do': 'call minpac#status()'}) + \ call minpac#init() | call minpac#update('', {'do': 'call minpac#status()'}) command! PackStatus packadd minpac | source $MYVIMRC | - \ call minpac#status() + \ call minpac#init() | call minpac#status() command! PackClean packadd minpac | source $MYVIMRC | - \ call minpac#clean() + \ call minpac#init() | call minpac#clean() " Sort Python Imports command! ISort call do#isort() diff --git a/vimrc b/vimrc index 25f7087..fb2d5a8 100644 --- a/vimrc +++ b/vimrc @@ -12,8 +12,7 @@ if has('syntax') && !exists('g:syntax_on') endif if exists('*minpac#init') - " When minpac is loaded initialize and define the Pack command. - call minpac#init() + " When minpac is loaded define the Pack command to add packages. command! -nargs=+ Pack call minpac#add() else " Otherwise define the Pack command to do nothing. @@ -203,11 +202,11 @@ Pack 'jrozner/vim-antlr' Pack 'greymd/oscyank.vim', {'type': 'opt'} let g:use_osc52 = $TMUX !=# '' && \ trim(system('tmux show-options -g set-clipboard')) ==# 'set-clipboard on' -if g:use_osc52 +if g:use_osc52 && isdirectory('pack/minpac/opt/oscyank.vim') packadd oscyank.vim endif " Load YouComplteMe if termdebug plugin is not loaded. -if !exists(':Termdebug') +if !exists(':Termdebug') && isdirectory('pack/minpac/opt/YouCompleteMe') packadd YouCompleteMe endif