aboutsummaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2020-06-27 21:06:55 +0100
committerJuan J. Martinez <jjm@usebox.net>2022-05-29 22:57:29 +0100
commitc28b9e181f1840c90a5d7d267eb549658c11570b (patch)
tree16c839ee767f8b8056ba089abbb13a0cc6689ecb /autoload
parent7fc3dde110e447e3e791430489fe4cef488997f5 (diff)
downloaddotnvim-c28b9e181f1840c90a5d7d267eb549658c11570b.tar.gz
dotnvim-c28b9e181f1840c90a5d7d267eb549658c11570b.zip
Upgraded vim-plug
Diffstat (limited to 'autoload')
-rw-r--r--autoload/plug.vim47
1 files changed, 41 insertions, 6 deletions
diff --git a/autoload/plug.vim b/autoload/plug.vim
index bc02f03..69033ec 100644
--- a/autoload/plug.vim
+++ b/autoload/plug.vim
@@ -632,17 +632,39 @@ function! plug#(repo, ...)
let g:plugs[name] = spec
let s:loaded[name] = get(s:loaded, name, 0)
catch
- return s:err(v:exception)
+ return s:err(repo . ' ' . v:exception)
endtry
endfunction
function! s:parse_options(arg)
let opts = copy(s:base_spec)
let type = type(a:arg)
+ let opt_errfmt = 'Invalid argument for "%s" option of :Plug (expected: %s)'
if type == s:TYPE.string
+ if empty(a:arg)
+ throw printf(opt_errfmt, 'tag', 'string')
+ endif
let opts.tag = a:arg
elseif type == s:TYPE.dict
call extend(opts, a:arg)
+ for opt in ['branch', 'tag', 'commit', 'rtp', 'dir', 'as']
+ if has_key(opts, opt)
+ \ && (type(opts[opt]) != s:TYPE.string || empty(opts[opt]))
+ throw printf(opt_errfmt, opt, 'string')
+ endif
+ endfor
+ for opt in ['on', 'for']
+ if has_key(opts, opt)
+ \ && type(opts[opt]) != s:TYPE.list
+ \ && (type(opts[opt]) != s:TYPE.string || empty(opts[opt]))
+ throw printf(opt_errfmt, opt, 'string or list')
+ endif
+ endfor
+ if has_key(opts, 'do')
+ \ && type(opts.do) != s:TYPE.funcref
+ \ && (type(opts.do) != s:TYPE.string || empty(opts.do))
+ throw printf(opt_errfmt, 'do', 'string or funcref')
+ endif
if has_key(opts, 'dir')
let opts.dir = s:dirpath(s:plug_expand(opts.dir))
endif
@@ -942,6 +964,7 @@ function! s:do(pull, force, todo)
endif
elseif type == s:TYPE.funcref
try
+ call s:load_plugin(spec)
let status = installed ? 'installed' : (updated ? 'updated' : 'unchanged')
call spec.do({ 'name': name, 'status': status, 'force': a:force })
catch
@@ -2248,7 +2271,7 @@ endfunction
function! s:rm_rf(dir)
if isdirectory(a:dir)
- call s:system(s:is_win
+ return s:system(s:is_win
\ ? 'rmdir /S /Q '.plug#shellescape(a:dir)
\ : ['rm', '-rf', a:dir])
endif
@@ -2332,6 +2355,7 @@ endfunction
function! s:delete(range, force)
let [l1, l2] = a:range
let force = a:force
+ let err_count = 0
while l1 <= l2
let line = getline(l1)
if line =~ '^- ' && isdirectory(line[2:])
@@ -2340,11 +2364,22 @@ function! s:delete(range, force)
let answer = force ? 1 : s:ask('Delete '.line[2:].'?', 1)
let force = force || answer > 1
if answer
- call s:rm_rf(line[2:])
+ let err = s:rm_rf(line[2:])
setlocal modifiable
- call setline(l1, '~'.line[1:])
- let s:clean_count += 1
- call setline(4, printf('Removed %d directories.', s:clean_count))
+ if empty(err)
+ call setline(l1, '~'.line[1:])
+ let s:clean_count += 1
+ else
+ delete _
+ call append(l1 - 1, s:format_message('x', line[1:], err))
+ let l2 += len(s:lines(err))
+ let err_count += 1
+ endif
+ let msg = printf('Removed %d directories.', s:clean_count)
+ if err_count > 0
+ let msg .= printf(' Failed to remove %d directories.', err_count)
+ endif
+ call setline(4, msg)
setlocal nomodifiable
endif
endif