|
@@ -337,7 +337,12 @@ function! s:err(msg)
|
|
|
echohl ErrorMsg
|
|
echohl ErrorMsg
|
|
|
echom '[vim-plug] '.a:msg
|
|
echom '[vim-plug] '.a:msg
|
|
|
echohl None
|
|
echohl None
|
|
|
- return 0
|
|
|
|
|
|
|
+endfunction
|
|
|
|
|
+
|
|
|
|
|
+function! s:warn(cmd, msg)
|
|
|
|
|
+ echohl WarningMsg
|
|
|
|
|
+ execute a:cmd 'a:msg'
|
|
|
|
|
+ echohl None
|
|
|
endfunction
|
|
endfunction
|
|
|
|
|
|
|
|
function! s:esc(path)
|
|
function! s:esc(path)
|
|
@@ -386,6 +391,10 @@ function! s:reorg_rtp()
|
|
|
endif
|
|
endif
|
|
|
endfunction
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
+function! s:doautocmd(...)
|
|
|
|
|
+ execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '<nomodeline>' : '') join(a:000)
|
|
|
|
|
+endfunction
|
|
|
|
|
+
|
|
|
function! plug#load(...)
|
|
function! plug#load(...)
|
|
|
if a:0 == 0
|
|
if a:0 == 0
|
|
|
return s:err('Argument missing: plugin name(s) required')
|
|
return s:err('Argument missing: plugin name(s) required')
|
|
@@ -440,7 +449,7 @@ function! s:lod(names, types, ...)
|
|
|
call s:source(rtp, a:2)
|
|
call s:source(rtp, a:2)
|
|
|
endif
|
|
endif
|
|
|
if exists('#User#'.name)
|
|
if exists('#User#'.name)
|
|
|
- execute 'doautocmd User' name
|
|
|
|
|
|
|
+ call s:doautocmd('User', name)
|
|
|
endif
|
|
endif
|
|
|
endfor
|
|
endfor
|
|
|
endfunction
|
|
endfunction
|
|
@@ -656,7 +665,7 @@ function! s:switch_out(...)
|
|
|
endfunction
|
|
endfunction
|
|
|
|
|
|
|
|
function! s:finish_bindings()
|
|
function! s:finish_bindings()
|
|
|
- nnoremap <silent> <buffer> R :silent! call <SID>retry()<cr>
|
|
|
|
|
|
|
+ nnoremap <silent> <buffer> R :call <SID>retry()<cr>
|
|
|
nnoremap <silent> <buffer> D :PlugDiff<cr>
|
|
nnoremap <silent> <buffer> D :PlugDiff<cr>
|
|
|
nnoremap <silent> <buffer> S :PlugStatus<cr>
|
|
nnoremap <silent> <buffer> S :PlugStatus<cr>
|
|
|
nnoremap <silent> <buffer> U :call <SID>status_update()<cr>
|
|
nnoremap <silent> <buffer> U :call <SID>status_update()<cr>
|
|
@@ -726,8 +735,8 @@ function! s:regress_bar()
|
|
|
call s:progress_bar(2, bar, len(bar))
|
|
call s:progress_bar(2, bar, len(bar))
|
|
|
endfunction
|
|
endfunction
|
|
|
|
|
|
|
|
-function! s:is_updated(file, dir)
|
|
|
|
|
- return !empty(s:system_chomp('git log --pretty=format:"%h" "HEAD...HEAD@{1}" '.a:file, a:dir))
|
|
|
|
|
|
|
+function! s:is_updated(dir)
|
|
|
|
|
+ return !empty(s:system_chomp('git log --pretty=format:"%h" "HEAD...HEAD@{1}"', a:dir))
|
|
|
endfunction
|
|
endfunction
|
|
|
|
|
|
|
|
function! s:do(pull, force, todo)
|
|
function! s:do(pull, force, todo)
|
|
@@ -737,7 +746,7 @@ function! s:do(pull, force, todo)
|
|
|
endif
|
|
endif
|
|
|
let installed = has_key(s:update.new, name)
|
|
let installed = has_key(s:update.new, name)
|
|
|
let updated = installed ? 0 :
|
|
let updated = installed ? 0 :
|
|
|
- \ (a:pull && index(s:update.errors, name) < 0 && s:is_updated('', spec.dir))
|
|
|
|
|
|
|
+ \ (a:pull && index(s:update.errors, name) < 0 && s:is_updated(spec.dir))
|
|
|
if a:force || installed || updated
|
|
if a:force || installed || updated
|
|
|
execute 'cd' s:esc(spec.dir)
|
|
execute 'cd' s:esc(spec.dir)
|
|
|
call append(3, '- Post-update hook for '. name .' ... ')
|
|
call append(3, '- Post-update hook for '. name .' ... ')
|
|
@@ -808,6 +817,7 @@ function! s:retry()
|
|
|
if empty(s:update.errors)
|
|
if empty(s:update.errors)
|
|
|
return
|
|
return
|
|
|
endif
|
|
endif
|
|
|
|
|
+ echo
|
|
|
call s:update_impl(s:update.pull, s:update.force,
|
|
call s:update_impl(s:update.pull, s:update.force,
|
|
|
\ extend(copy(s:update.errors), [s:update.threads]))
|
|
\ extend(copy(s:update.errors), [s:update.threads]))
|
|
|
endfunction
|
|
endfunction
|
|
@@ -820,6 +830,16 @@ function! s:names(...)
|
|
|
return sort(filter(keys(g:plugs), 'stridx(v:val, a:1) == 0 && s:is_managed(v:val)'))
|
|
return sort(filter(keys(g:plugs), 'stridx(v:val, a:1) == 0 && s:is_managed(v:val)'))
|
|
|
endfunction
|
|
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
|
|
function! s:update_impl(pull, force, args) abort
|
|
|
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]*$') ?
|
|
@@ -830,10 +850,7 @@ function! s:update_impl(pull, force, args) abort
|
|
|
\ filter(managed, 'index(args, v:key) >= 0')
|
|
\ filter(managed, 'index(args, v:key) >= 0')
|
|
|
|
|
|
|
|
if empty(todo)
|
|
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
|
|
endif
|
|
|
|
|
|
|
|
if !s:is_win && s:git_version_requirement(2, 3)
|
|
if !s:is_win && s:git_version_requirement(2, 3)
|
|
@@ -855,13 +872,11 @@ function! s:update_impl(pull, force, args) abort
|
|
|
endif
|
|
endif
|
|
|
|
|
|
|
|
if has('nvim') && !exists('*jobwait') && threads > 1
|
|
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
|
|
endif
|
|
|
|
|
|
|
|
let python = (has('python') || has('python3')) && (!s:nvim || has('vim_starting'))
|
|
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 = {
|
|
let s:update = {
|
|
|
\ 'start': reltime(),
|
|
\ 'start': reltime(),
|
|
@@ -958,7 +973,7 @@ function! s:update_finish()
|
|
|
\. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only origin/'.branch.' 2>&1')), spec.dir)
|
|
\. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only origin/'.branch.' 2>&1')), spec.dir)
|
|
|
endif
|
|
endif
|
|
|
if !v:shell_error && filereadable(spec.dir.'/.gitmodules') &&
|
|
if !v:shell_error && filereadable(spec.dir.'/.gitmodules') &&
|
|
|
- \ (has_key(s:update.new, name) || s:is_updated('.gitmodules', spec.dir))
|
|
|
|
|
|
|
+ \ (has_key(s:update.new, name) || s:is_updated(spec.dir))
|
|
|
call s:log4(name, 'Updating submodules. This may take a while.')
|
|
call s:log4(name, 'Updating submodules. This may take a while.')
|
|
|
let out .= s:bang('git submodule update --init --recursive 2>&1', spec.dir)
|
|
let out .= s:bang('git submodule update --init --recursive 2>&1', spec.dir)
|
|
|
endif
|
|
endif
|
|
@@ -1084,7 +1099,6 @@ function! s:logpos(name)
|
|
|
return i
|
|
return i
|
|
|
endif
|
|
endif
|
|
|
endfor
|
|
endfor
|
|
|
- return 0
|
|
|
|
|
endfunction
|
|
endfunction
|
|
|
|
|
|
|
|
function! s:log(bullet, name, lines)
|
|
function! s:log(bullet, name, lines)
|
|
@@ -1420,7 +1434,7 @@ class Plugin(object):
|
|
|
self.write(Action.DONE, self.name, result[-1:])
|
|
self.write(Action.DONE, self.name, result[-1:])
|
|
|
|
|
|
|
|
def repo_uri(self):
|
|
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,)
|
|
command = Command(cmd, self.args['dir'], G_TIMEOUT,)
|
|
|
result = command.execute(G_RETRIES)
|
|
result = command.execute(G_RETRIES)
|
|
|
return result[-1]
|
|
return result[-1]
|
|
@@ -1721,7 +1735,7 @@ function! s:update_ruby()
|
|
|
ok, result =
|
|
ok, result =
|
|
|
if exists
|
|
if exists
|
|
|
chdir = "#{cd} #{iswin ? dir : esc(dir)}"
|
|
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
|
|
current_uri = data.lines.to_a.last
|
|
|
if !ret
|
|
if !ret
|
|
|
if data =~ /^Interrupted|^Timeout/
|
|
if data =~ /^Interrupted|^Timeout/
|
|
@@ -1814,7 +1828,7 @@ endfunction
|
|
|
function! s:git_validate(spec, check_branch)
|
|
function! s:git_validate(spec, check_branch)
|
|
|
let err = ''
|
|
let err = ''
|
|
|
if isdirectory(a:spec.dir)
|
|
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]
|
|
let remote = result[-1]
|
|
|
if v:shell_error
|
|
if v:shell_error
|
|
|
let err = join([remote, 'PlugClean required.'], "\n")
|
|
let err = join([remote, 'PlugClean required.'], "\n")
|
|
@@ -2022,7 +2036,6 @@ function! s:is_preview_window_open()
|
|
|
wincmd p
|
|
wincmd p
|
|
|
return 1
|
|
return 1
|
|
|
endif
|
|
endif
|
|
|
- return 0
|
|
|
|
|
endfunction
|
|
endfunction
|
|
|
|
|
|
|
|
function! s:find_name(lnum)
|
|
function! s:find_name(lnum)
|
|
@@ -2057,7 +2070,7 @@ function! s:preview_commit()
|
|
|
execute 'pedit' sha
|
|
execute 'pedit' sha
|
|
|
wincmd P
|
|
wincmd P
|
|
|
setlocal filetype=git buftype=nofile nobuflisted modifiable
|
|
setlocal filetype=git buftype=nofile nobuflisted modifiable
|
|
|
- execute 'silent read !cd' s:shellesc(g:plugs[name].dir) '&& git show --pretty=medium' sha
|
|
|
|
|
|
|
+ execute 'silent read !cd' s:shellesc(g:plugs[name].dir) '&& git show --no-color --pretty=medium' sha
|
|
|
normal! gg"_dd
|
|
normal! gg"_dd
|
|
|
setlocal nomodifiable
|
|
setlocal nomodifiable
|
|
|
nnoremap <silent> <buffer> q :q<cr>
|
|
nnoremap <silent> <buffer> q :q<cr>
|