From 4083e3bfcb4b4fc94fb224c672efc0ac1c438877 Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Thu, 1 Jun 2017 18:15:33 +0200 Subject: nvim: Update plug.vim MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- nvim/autoload/plug.vim | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'nvim') diff --git a/nvim/autoload/plug.vim b/nvim/autoload/plug.vim index 7819a5a..ac299a2 100644 --- a/nvim/autoload/plug.vim +++ b/nvim/autoload/plug.vim @@ -97,7 +97,7 @@ let s:plug_tab = get(s:, 'plug_tab', -1) let s:plug_buf = get(s:, 'plug_buf', -1) let s:mac_gui = has('gui_macvim') && has('gui_running') let s:is_win = has('win32') || has('win64') -let s:nvim = has('nvim') && exists('*jobwait') && !s:is_win +let s:nvim = has('nvim-0.2') || (has('nvim') && exists('*jobwait') && !s:is_win) let s:vim8 = has('patch-8.0.0039') && exists('*job_start') let s:me = resolve(expand(':p')) let s:base_spec = { 'branch': 'master', 'frozen': 0 } @@ -447,11 +447,15 @@ function! plug#load(...) let s = len(unknowns) > 1 ? 's' : '' return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', '))) end - for name in a:000 - call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) - endfor - call s:dobufread(a:000) - return 1 + let unloaded = filter(copy(a:000), '!get(s:loaded, v:val, 0)') + if !empty(unloaded) + for name in unloaded + call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) + endfor + call s:dobufread(unloaded) + return 1 + end + return 0 endfunction function! s:remove_triggers(name) @@ -575,7 +579,7 @@ function! s:infer_properties(name, repo) let uri = repo else if repo !~ '/' - let repo = 'vim-scripts/'. repo + throw printf('Invalid argument: %s (implicit `vim-scripts'' expansion is deprecated)', repo) endif let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git') let uri = printf(fmt, repo) @@ -868,7 +872,7 @@ function! s:checkout(spec) let output = s:system('git rev-parse HEAD', a:spec.dir) if !v:shell_error && !s:hash_match(sha, s:lines(output)[0]) let output = s:system( - \ 'git fetch --depth 999999 && git checkout '.s:esc(sha), a:spec.dir) + \ 'git fetch --depth 999999 && git checkout '.s:esc(sha).' --', a:spec.dir) endif return output endfunction @@ -986,6 +990,10 @@ function! s:update_impl(pull, force, args) abort let s:clone_opt = get(g:, 'plug_shallow', 1) ? \ '--depth 1' . (s:git_version_requirement(1, 7, 10) ? ' --no-single-branch' : '') : '' + if has('win32unix') + let s:clone_opt .= ' -c core.eol=lf -c core.autocrlf=input' + endif + " Python version requirement (>= 2.7) if python && !has('python3') && !ruby && !use_job && s:update.threads > 1 redir => pyv @@ -1059,7 +1067,7 @@ function! s:update_finish() elseif has_key(spec, 'tag') let tag = spec.tag if tag =~ '\*' - let tags = s:lines(s:system('git tag --list '.string(tag).' --sort -version:refname 2>&1', spec.dir)) + let tags = s:lines(s:system('git tag --list '.s:shellesc(tag).' --sort -version:refname 2>&1', spec.dir)) if !v:shell_error && !empty(tags) let tag = tags[0] call s:log4(name, printf('Latest tag for %s -> %s', spec.tag, tag)) @@ -1067,11 +1075,11 @@ function! s:update_finish() endif endif call s:log4(name, 'Checking out '.tag) - let out = s:system('git checkout -q '.s:esc(tag).' 2>&1', spec.dir) + let out = s:system('git checkout -q '.s:esc(tag).' -- 2>&1', spec.dir) else let branch = s:esc(get(spec, 'branch', 'master')) call s:log4(name, 'Merging origin/'.branch) - let out = s:system('git checkout -q '.branch.' 2>&1' + let out = s:system('git checkout -q '.branch.' -- 2>&1' \. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only origin/'.branch.' 2>&1')), spec.dir) endif if !v:shell_error && filereadable(spec.dir.'/.gitmodules') && @@ -2018,7 +2026,7 @@ function! s:git_validate(spec, check_branch) " Check tag if has_key(a:spec, 'tag') let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir) - if a:spec.tag !=# tag + if a:spec.tag !=# tag && a:spec.tag !~ '\*' let err = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.', \ (empty(tag) ? 'N/A' : tag), a:spec.tag) endif @@ -2390,7 +2398,7 @@ function! s:revert() return endif - call s:system('git reset --hard HEAD@{1} && git checkout '.s:esc(g:plugs[name].branch), g:plugs[name].dir) + call s:system('git reset --hard HEAD@{1} && git checkout '.s:esc(g:plugs[name].branch).' --', g:plugs[name].dir) setlocal modifiable normal! "_dap setlocal nomodifiable -- cgit v1.2.3-70-g09d2