From e5f14898b69e07c4b2be506aa8146bc0a311cd74 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Sun, 3 Apr 2016 21:28:01 -0500 Subject: [PATCH] upgrade plug --- config/nvim/autoload/plug.vim | 39 +++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/config/nvim/autoload/plug.vim b/config/nvim/autoload/plug.vim index e07a8ca..a55af87 100644 --- a/config/nvim/autoload/plug.vim +++ b/config/nvim/autoload/plug.vim @@ -337,7 +337,12 @@ function! s:err(msg) echohl ErrorMsg echom '[vim-plug] '.a:msg echohl None - return 0 +endfunction + +function! s:warn(cmd, msg) + echohl WarningMsg + execute a:cmd 'a:msg' + echohl None endfunction function! s:esc(path) @@ -660,7 +665,7 @@ function! s:switch_out(...) endfunction function! s:finish_bindings() - nnoremap R :silent! call retry() + nnoremap R :call retry() nnoremap D :PlugDiff nnoremap S :PlugStatus nnoremap U :call status_update() @@ -812,6 +817,7 @@ function! s:retry() if empty(s:update.errors) return endif + echo call s:update_impl(s:update.pull, s:update.force, \ extend(copy(s:update.errors), [s:update.threads])) endfunction @@ -824,6 +830,16 @@ function! s:names(...) return sort(filter(keys(g:plugs), 'stridx(v:val, a:1) == 0 && s:is_managed(v:val)')) endfunction +function! s:check_ruby() + silent! ruby require 'thread'; VIM::command('let g:plug_ruby = 1') + if get(g:, 'plug_ruby', 0) + unlet g:plug_ruby + return 1 + endif + redraw! + return s:warn('echom', 'Warning: Ruby interface is broken') +endfunction + function! s:update_impl(pull, force, args) abort let args = copy(a:args) let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ? @@ -834,10 +850,7 @@ function! s:update_impl(pull, force, args) abort \ filter(managed, 'index(args, v:key) >= 0') if empty(todo) - echohl WarningMsg - echo 'No plugin to '. (a:pull ? 'update' : 'install') . '.' - echohl None - return + return s:warn('echo', 'No plugin to '. (a:pull ? 'update' : 'install')) endif if !s:is_win && s:git_version_requirement(2, 3) @@ -859,13 +872,11 @@ function! s:update_impl(pull, force, args) abort endif if has('nvim') && !exists('*jobwait') && threads > 1 - echohl WarningMsg - echomsg 'vim-plug: update Neovim for parallel installer' - echohl None + call s:warn('echom', '[vim-plug] Update Neovim for parallel installer') endif let python = (has('python') || has('python3')) && (!s:nvim || has('vim_starting')) - let ruby = has('ruby') && !s:nvim && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) + let ruby = has('ruby') && !s:nvim && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) && s:check_ruby() let s:update = { \ 'start': reltime(), @@ -1088,7 +1099,6 @@ function! s:logpos(name) return i endif endfor - return 0 endfunction function! s:log(bullet, name, lines) @@ -1424,7 +1434,7 @@ class Plugin(object): self.write(Action.DONE, self.name, result[-1:]) def repo_uri(self): - cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url' + cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url' command = Command(cmd, self.args['dir'], G_TIMEOUT,) result = command.execute(G_RETRIES) return result[-1] @@ -1725,7 +1735,7 @@ function! s:update_ruby() ok, result = if exists chdir = "#{cd} #{iswin ? dir : esc(dir)}" - ret, data = bt.call "#{chdir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url", nil, nil, nil + ret, data = bt.call "#{chdir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url", nil, nil, nil current_uri = data.lines.to_a.last if !ret if data =~ /^Interrupted|^Timeout/ @@ -1818,7 +1828,7 @@ endfunction function! s:git_validate(spec, check_branch) let err = '' if isdirectory(a:spec.dir) - let result = s:lines(s:system('git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url', a:spec.dir)) + let result = s:lines(s:system('git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url', a:spec.dir)) let remote = result[-1] if v:shell_error let err = join([remote, 'PlugClean required.'], "\n") @@ -2026,7 +2036,6 @@ function! s:is_preview_window_open() wincmd p return 1 endif - return 0 endfunction function! s:find_name(lnum)