mirror of
https://github.com/junegunn/vim-plug.git
synced 2024-12-19 10:35:38 -07:00
Fall back to Python installer if Ruby is broken
Close #460. Also remove unnecessary `return 0` statements.
This commit is contained in:
parent
76e9076ef4
commit
158fd28bc4
30
plug.vim
30
plug.vim
@ -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)
|
||||||
@ -825,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]*$') ?
|
||||||
@ -835,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
|
return s:warn('echo', 'No plugin to '. (a:pull ? 'update' : 'install'))
|
||||||
echo 'No plugin to '. (a:pull ? 'update' : 'install') . '.'
|
|
||||||
echohl None
|
|
||||||
return
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !s:is_win && s:git_version_requirement(2, 3)
|
if !s:is_win && s:git_version_requirement(2, 3)
|
||||||
@ -860,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
|
call s:warn('echom', '[vim-plug] Update Neovim for parallel installer')
|
||||||
echomsg 'vim-plug: update Neovim for parallel installer'
|
|
||||||
echohl None
|
|
||||||
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(),
|
||||||
@ -1089,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)
|
||||||
@ -2027,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)
|
||||||
|
Loading…
Reference in New Issue
Block a user