Skip to content

Commit c1bbbaf

Browse files
committed
Allow Plug command even when git executable is not found (#52)
- plug#begin() will return 1 even when git executable is not found - Commands that require git will not be available - If you wish to ignore the error message prepend `silent!` to the call
1 parent f7ebba7 commit c1bbbaf

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Diff for: plug.vim

+4-5
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,6 @@ function! plug#begin(...)
9393
return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.')
9494
endif
9595

96-
if !executable('git')
97-
return s:err('`git` executable not found. vim-plug requires git.')
98-
endif
99-
10096
let g:plug_home = home
10197
let g:plugs = {}
10298
" we want to keep track of the order plugins where registered.
@@ -107,7 +103,10 @@ function! plug#begin(...)
107103
endfunction
108104

109105
function! s:define_commands()
110-
command! -nargs=+ -bar Plug call s:add(<args>)
106+
command! -nargs=+ -bar Plug call s:add(<args>)
107+
if !executable('git')
108+
return s:err('`git` executable not found. vim-plug requires git.')
109+
endif
111110
command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install('<bang>' == '!', <f-args>)
112111
command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update('<bang>' == '!', <f-args>)
113112
command! -nargs=0 -bar -bang PlugClean call s:clean('<bang>' == '!')

0 commit comments

Comments
 (0)