Commit dc7cad30 authored by Murukesh Mohanan's avatar Murukesh Mohanan

vim-plug bump

parent 3ac27820
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
" " Any valid git URL is allowed " " Any valid git URL is allowed
" Plug 'https://github.com/junegunn/vim-github-dashboard.git' " Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" "
" " Group dependencies, vim-snippets depends on ultisnips " " Multiple Plug commands can be written in a single line using | separators
" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' " Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" "
" " On-demand loading " " On-demand loading
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
" " Unmanaged plugin (manually installed and updated) " " Unmanaged plugin (manually installed and updated)
" Plug '~/my-prototype-plugin' " Plug '~/my-prototype-plugin'
" "
" " Add plugins to &runtimepath " " Initialize plugin system
" call plug#end() " call plug#end()
" "
" Then reload .vimrc and :PlugInstall to install plugins. " Then reload .vimrc and :PlugInstall to install plugins.
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
" More information: https://github.com/junegunn/vim-plug " More information: https://github.com/junegunn/vim-plug
" "
" "
" Copyright (c) 2016 Junegunn Choi " Copyright (c) 2017 Junegunn Choi
" "
" MIT License " MIT License
" "
...@@ -919,7 +919,8 @@ function! s:check_ruby() ...@@ -919,7 +919,8 @@ function! s:check_ruby()
endfunction endfunction
function! s:update_impl(pull, force, args) abort function! s:update_impl(pull, force, args) abort
let args = copy(a:args) let sync = index(a:args, '--sync') >= 0 || has('vim_starting')
let args = filter(copy(a:args), 'v:val != "--sync"')
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)
...@@ -955,7 +956,7 @@ function! s:update_impl(pull, force, args) abort ...@@ -955,7 +956,7 @@ function! s:update_impl(pull, force, args) abort
let use_job = s:nvim || s:vim8 let use_job = s:nvim || s:vim8
let python = (has('python') || has('python3')) && !use_job let python = (has('python') || has('python3')) && !use_job
let ruby = has('ruby') && !use_job && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) && s:check_ruby() let ruby = has('ruby') && !use_job && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) && threads > 1 && s:check_ruby()
let s:update = { let s:update = {
\ 'start': reltime(), \ 'start': reltime(),
...@@ -1020,7 +1021,7 @@ function! s:update_impl(pull, force, args) abort ...@@ -1020,7 +1021,7 @@ function! s:update_impl(pull, force, args) abort
endtry endtry
else else
call s:update_vim() call s:update_vim()
while use_job && has('vim_starting') while use_job && sync
sleep 100m sleep 100m
if s:update.fin if s:update.fin
break break
...@@ -1142,6 +1143,9 @@ endfunction ...@@ -1142,6 +1143,9 @@ endfunction
function! s:job_exit_cb(self, data) abort function! s:job_exit_cb(self, data) abort
let a:self.running = 0 let a:self.running = 0
let a:self.error = a:data != 0 let a:self.error = a:data != 0
if has_key(a:self, 'tempname')
call delete(a:self.tempname)
endif
call s:reap(a:self.name) call s:reap(a:self.name)
call s:tick() call s:tick()
endfunction endfunction
...@@ -1153,7 +1157,7 @@ function! s:job_cb(fn, job, ch, data) ...@@ -1153,7 +1157,7 @@ function! s:job_cb(fn, job, ch, data)
call call(a:fn, [a:job, a:data]) call call(a:fn, [a:job, a:data])
endfunction endfunction
function! s:nvim_cb(job_id, data, event) abort function! s:nvim_cb(job_id, data, event) dict abort
return a:event == 'stdout' ? return a:event == 'stdout' ?
\ s:job_cb('s:job_out_cb', self, 0, join(a:data, "\n")) : \ s:job_cb('s:job_out_cb', self, 0, join(a:data, "\n")) :
\ s:job_cb('s:job_exit_cb', self, 0, a:data) \ s:job_cb('s:job_exit_cb', self, 0, a:data)
...@@ -1163,8 +1167,8 @@ function! s:spawn(name, cmd, opts) ...@@ -1163,8 +1167,8 @@ function! s:spawn(name, cmd, opts)
let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''], let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''],
\ 'new': get(a:opts, 'new', 0) } \ 'new': get(a:opts, 'new', 0) }
let s:jobs[a:name] = job let s:jobs[a:name] = job
let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd
\ has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd) let argv = s:is_win ? cmd : ['sh', '-c', cmd]
if s:nvim if s:nvim
call extend(job, { call extend(job, {
...@@ -1181,6 +1185,11 @@ function! s:spawn(name, cmd, opts) ...@@ -1181,6 +1185,11 @@ function! s:spawn(name, cmd, opts)
\ 'Invalid arguments (or job table is full)'] \ 'Invalid arguments (or job table is full)']
endif endif
elseif s:vim8 elseif s:vim8
if s:is_win
let job.tempname = tempname().'.bat'
call writefile([argv], job.tempname)
let argv = job.tempname
endif
let jid = job_start(argv, { let jid = job_start(argv, {
\ 'out_cb': function('s:job_cb', ['s:job_out_cb', job]), \ 'out_cb': function('s:job_cb', ['s:job_out_cb', job]),
\ 'exit_cb': function('s:job_cb', ['s:job_exit_cb', job]), \ 'exit_cb': function('s:job_cb', ['s:job_exit_cb', job]),
...@@ -2013,10 +2022,21 @@ function! s:git_validate(spec, check_branch) ...@@ -2013,10 +2022,21 @@ function! s:git_validate(spec, check_branch)
\ branch, a:spec.branch) \ branch, a:spec.branch)
endif endif
if empty(err) if empty(err)
let commits = len(s:lines(s:system(printf('git rev-list origin/%s..HEAD', a:spec.branch), a:spec.dir))) let [ahead, behind] = split(s:lastline(s:system(printf(
if !v:shell_error && commits \ 'git rev-list --count --left-right HEAD...origin/%s',
let err = join([printf('Diverged from origin/%s by %d commit(s).', a:spec.branch, commits), \ a:spec.branch), a:spec.dir)), '\t')
\ 'Reinstall after PlugClean.'], "\n") if !v:shell_error && ahead
if behind
" Only mention PlugClean if diverged, otherwise it's likely to be
" pushable (and probably not that messed up).
let err = printf(
\ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n"
\ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', a:spec.branch, ahead, behind)
else
let err = printf("Ahead of origin/%s by %d commit(s).\n"
\ .'Cannot update until local changes are pushed.',
\ a:spec.branch, ahead)
endif
endif endif
endif endif
endif endif
...@@ -2277,7 +2297,12 @@ function! s:preview_commit() ...@@ -2277,7 +2297,12 @@ function! s:preview_commit()
wincmd P wincmd P
endif endif
setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable
try
let [sh, shrd] = s:chsh(1)
execute 'silent %!cd' s:shellesc(g:plugs[name].dir) '&& git show --no-color --pretty=medium' sha execute 'silent %!cd' s:shellesc(g:plugs[name].dir) '&& git show --no-color --pretty=medium' sha
finally
let [&shell, &shellredir] = [sh, shrd]
endtry
setlocal nomodifiable setlocal nomodifiable
nnoremap <silent> <buffer> q :q<cr> nnoremap <silent> <buffer> q :q<cr>
wincmd p wincmd p
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment