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`
This commit is contained in:
Kenneth Benzie 2020-11-28 17:16:11 +00:00
parent 3cc1e3d2d8
commit e4a11a2ffe
2 changed files with 6 additions and 7 deletions

View File

@ -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()

7
vimrc
View File

@ -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(<args>)
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