|
|
@@ -217,12 +217,7 @@ function! s:finish()
|
|
|
endfunction
|
|
|
|
|
|
function! s:update_impl(pull, args)
|
|
|
- if has('ruby') && get(g:, 'plug_parallel', 1)
|
|
|
- let threads = min(
|
|
|
- \ [len(g:plugs), len(a:args) > 0 ? a:args[0] : get(g:, 'plug_threads', 16)])
|
|
|
- else
|
|
|
- let threads = 1
|
|
|
- endif
|
|
|
+ let threads = len(a:args) > 0 ? a:args[0] : get(g:, 'plug_threads', 16)
|
|
|
|
|
|
call s:prepare()
|
|
|
call append(0, a:pull ? 'Updating plugins' : 'Installing plugins')
|
|
|
@@ -230,7 +225,7 @@ function! s:update_impl(pull, args)
|
|
|
normal! 2G
|
|
|
redraw
|
|
|
|
|
|
- if threads > 1
|
|
|
+ if has('ruby') && threads > 1
|
|
|
call s:update_parallel(a:pull, threads)
|
|
|
else
|
|
|
call s:update_serial(a:pull)
|
|
|
@@ -255,8 +250,9 @@ function! s:extend(names)
|
|
|
return filter(copy(g:plugs), '!has_key(prev, v:key)')
|
|
|
endfunction
|
|
|
|
|
|
-function! s:update_progress(cnt, total)
|
|
|
- call setline(1, "Updating plugins (".a:cnt."/".a:total.")")
|
|
|
+function! s:update_progress(pull, cnt, total)
|
|
|
+ call setline(1, (a:pull ? 'Updating' : 'Installing').
|
|
|
+ \ " plugins (".a:cnt."/".a:total.")")
|
|
|
call s:progress_bar(2, a:cnt, a:total)
|
|
|
normal! 2G
|
|
|
redraw
|
|
|
@@ -300,13 +296,13 @@ function! s:update_serial(pull)
|
|
|
let result = '(x) ' . result
|
|
|
endif
|
|
|
call append(3, '- ' . name . ': ' . result)
|
|
|
- call s:update_progress(len(done), total)
|
|
|
+ call s:update_progress(a:pull, len(done), total)
|
|
|
endfor
|
|
|
|
|
|
if !empty(s:extend(keys(todo)))
|
|
|
let todo = filter(copy(g:plugs), '!has_key(done, v:key)')
|
|
|
let total += len(todo)
|
|
|
- call s:update_progress(len(done), total)
|
|
|
+ call s:update_progress(a:pull, len(done), total)
|
|
|
else
|
|
|
break
|
|
|
endif
|
|
|
@@ -330,7 +326,7 @@ function! s:update_parallel(pull, threads)
|
|
|
take1 = proc { mtx.synchronize { all.shift } }
|
|
|
logh = proc {
|
|
|
cnt, tot = done.length, VIM::evaluate('len(g:plugs)')
|
|
|
- $curbuf[1] = "Updating plugins (#{cnt}/#{tot})"
|
|
|
+ $curbuf[1] = "#{pull ? 'Updating' : 'Installing'} plugins (#{cnt}/#{tot})"
|
|
|
$curbuf[2] = '[' + ('=' * cnt).ljust(tot) + ']'
|
|
|
VIM::command('normal! 2G')
|
|
|
VIM::command('redraw')
|