mirror of
https://github.com/junegunn/vim-plug.git
synced 2025-12-08 01:44:44 +08:00
Add --sync flag to Plug{Install,Update}
Installer is not synchronous when started on VimEnter since
has('vim_starting') returns 0 in that case. We needed a way to make the
installer synchronous.
Related: #574
This commit is contained in:
7
plug.vim
7
plug.vim
@@ -61,7 +61,7 @@
|
||||
" More information: https://github.com/junegunn/vim-plug
|
||||
"
|
||||
"
|
||||
" Copyright (c) 2016 Junegunn Choi
|
||||
" Copyright (c) 2017 Junegunn Choi
|
||||
"
|
||||
" MIT License
|
||||
"
|
||||
@@ -919,7 +919,8 @@ function! s:check_ruby()
|
||||
endfunction
|
||||
|
||||
function! s:update_impl(pull, force, args) abort
|
||||
let args = copy(a:args)
|
||||
let sync = index(a:args, '--sync') >= 0 || has('vim_starting')
|
||||
let args = filter(copy(a:args), 'v:val != "--sync"')
|
||||
let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ?
|
||||
\ remove(args, -1) : get(g:, 'plug_threads', 16)
|
||||
|
||||
@@ -1020,7 +1021,7 @@ function! s:update_impl(pull, force, args) abort
|
||||
endtry
|
||||
else
|
||||
call s:update_vim()
|
||||
while use_job && has('vim_starting')
|
||||
while use_job && sync
|
||||
sleep 100m
|
||||
if s:update.fin
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user