Merge d85465cb7e
into c88ab60007
This commit is contained in:
commit
f388be1782
27
plug.vim
27
plug.vim
|
@ -112,14 +112,17 @@ function! plug#begin(...)
|
||||||
return 1
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:define_commands()
|
function! s:git_exists()
|
||||||
command! -nargs=+ -bar Plug call s:add(<args>)
|
|
||||||
if !executable('git')
|
if !executable('git')
|
||||||
return s:err('`git` executable not found. vim-plug requires git.')
|
return s:err('`git` executable not found. vim-plug requires git.')
|
||||||
endif
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:define_commands()
|
||||||
|
command! -nargs=+ -bar Plug call s:add(<args>)
|
||||||
|
command! -nargs=0 -bar -bang PlugClean call s:clean(<bang>0)
|
||||||
command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install(<bang>0, [<f-args>])
|
command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install(<bang>0, [<f-args>])
|
||||||
command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(<bang>0, [<f-args>])
|
command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(<bang>0, [<f-args>])
|
||||||
command! -nargs=0 -bar -bang PlugClean call s:clean(<bang>0)
|
|
||||||
command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif
|
command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif
|
||||||
command! -nargs=0 -bar PlugStatus call s:status()
|
command! -nargs=0 -bar PlugStatus call s:status()
|
||||||
command! -nargs=0 -bar PlugDiff call s:diff()
|
command! -nargs=0 -bar PlugDiff call s:diff()
|
||||||
|
@ -776,6 +779,10 @@ function! s:names(...)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:update_impl(pull, force, args) abort
|
function! s:update_impl(pull, force, args) abort
|
||||||
|
if !s:git_exists()
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
let args = copy(a:args)
|
let args = copy(a:args)
|
||||||
let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ?
|
let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ?
|
||||||
\ remove(args, -1) : get(g:, 'plug_threads', 16)
|
\ remove(args, -1) : get(g:, 'plug_threads', 16)
|
||||||
|
@ -1847,6 +1854,10 @@ function! s:clean(force)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:upgrade()
|
function! s:upgrade()
|
||||||
|
if !s:git_exists()
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
echo 'Downloading the latest version of vim-plug'
|
echo 'Downloading the latest version of vim-plug'
|
||||||
redraw
|
redraw
|
||||||
let tmp = tempname()
|
let tmp = tempname()
|
||||||
|
@ -1880,6 +1891,9 @@ function! s:upgrade_specs()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:status()
|
function! s:status()
|
||||||
|
if !s:git_exists()
|
||||||
|
return
|
||||||
|
endif
|
||||||
call s:prepare()
|
call s:prepare()
|
||||||
call append(0, 'Checking plugins')
|
call append(0, 'Checking plugins')
|
||||||
call append(1, '')
|
call append(1, '')
|
||||||
|
@ -2012,6 +2026,9 @@ function! s:append_ul(lnum, text)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:diff()
|
function! s:diff()
|
||||||
|
if !s:git_exists()
|
||||||
|
return
|
||||||
|
endif
|
||||||
call s:prepare()
|
call s:prepare()
|
||||||
call append(0, ['Collecting changes ...', ''])
|
call append(0, ['Collecting changes ...', ''])
|
||||||
let cnts = [0, 0]
|
let cnts = [0, 0]
|
||||||
|
@ -2071,6 +2088,9 @@ function! s:revert()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:snapshot(force, ...) abort
|
function! s:snapshot(force, ...) abort
|
||||||
|
if !s:git_exists()
|
||||||
|
return
|
||||||
|
endif
|
||||||
call s:prepare()
|
call s:prepare()
|
||||||
setf vim
|
setf vim
|
||||||
call append(0, ['" Generated by vim-plug',
|
call append(0, ['" Generated by vim-plug',
|
||||||
|
@ -2117,4 +2137,3 @@ endif
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
let &cpo = s:cpo_save
|
||||||
unlet s:cpo_save
|
unlet s:cpo_save
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user