mirror of
https://github.com/junegunn/vim-plug.git
synced 2024-12-19 18:47:29 -07:00
Fix error on windows when plug home contains spaces (#154)
Also fixes blank command output.
This commit is contained in:
parent
95aa96a884
commit
59748b0680
14
plug.vim
14
plug.vim
@ -1479,7 +1479,7 @@ function! s:update_ruby()
|
|||||||
if iswin
|
if iswin
|
||||||
Timeout::timeout(timeout) do
|
Timeout::timeout(timeout) do
|
||||||
tmp = VIM::evaluate('tempname()')
|
tmp = VIM::evaluate('tempname()')
|
||||||
system("#{cmd} > #{tmp}")
|
system("(#{cmd}) > #{tmp}")
|
||||||
data = File.read(tmp).chomp
|
data = File.read(tmp).chomp
|
||||||
File.unlink tmp rescue nil
|
File.unlink tmp rescue nil
|
||||||
end
|
end
|
||||||
@ -1549,7 +1549,7 @@ function! s:update_ruby()
|
|||||||
exists = File.directory? dir
|
exists = File.directory? dir
|
||||||
ok, result =
|
ok, result =
|
||||||
if exists
|
if exists
|
||||||
dir = esc dir
|
dir = iswin ? dir : esc(dir)
|
||||||
ret, data = bt.call "#{cd} #{dir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url", nil, nil, nil
|
ret, data = bt.call "#{cd} #{dir} && git rev-parse --abbrev-ref HEAD 2>&1 && 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
|
||||||
@ -1565,7 +1565,7 @@ function! s:update_ruby()
|
|||||||
else
|
else
|
||||||
if pull
|
if pull
|
||||||
log.call name, 'Updating ...', :update
|
log.call name, 'Updating ...', :update
|
||||||
bt.call "#{cd} #{dir} && (git fetch #{progress} 2>&1 && git checkout -q #{checkout} 2>&1 && git merge --ff-only #{merge} 2>&1 && #{subm})", name, :update, nil
|
bt.call "#{cd} #{dir} && git fetch #{progress} 2>&1 && git checkout -q #{checkout} 2>&1 && git merge --ff-only #{merge} 2>&1 && #{subm}", name, :update, nil
|
||||||
else
|
else
|
||||||
[true, skip]
|
[true, skip]
|
||||||
end
|
end
|
||||||
@ -1618,7 +1618,7 @@ function! s:format_message(bullet, name, message)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:with_cd(cmd, dir)
|
function! s:with_cd(cmd, dir)
|
||||||
return (s:is_win ? 'cd /d ' : 'cd ').s:esc(a:dir).' && '.a:cmd
|
return printf('cd%s "%s" && %s', s:is_win ? ' /d' : '', escape(a:dir, '"'), a:cmd)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:system(cmd, ...)
|
function! s:system(cmd, ...)
|
||||||
@ -1904,7 +1904,7 @@ function! s:preview_commit()
|
|||||||
execute 'pedit' sha
|
execute 'pedit' sha
|
||||||
wincmd P
|
wincmd P
|
||||||
setlocal filetype=git buftype=nofile nobuflisted
|
setlocal filetype=git buftype=nofile nobuflisted
|
||||||
execute 'silent read !cd' s:esc(g:plugs[name].dir) '&& git show' sha
|
execute 'silent read !cd "'.escape(g:plugs[name].dir, '"').'" && git show' sha
|
||||||
normal! gg"_dd
|
normal! gg"_dd
|
||||||
wincmd p
|
wincmd p
|
||||||
endfunction
|
endfunction
|
||||||
@ -1966,7 +1966,7 @@ function! s:snapshot(...) abort
|
|||||||
let [type, var, header] = s:is_win ?
|
let [type, var, header] = s:is_win ?
|
||||||
\ ['dosbatch', '%PLUG_HOME%',
|
\ ['dosbatch', '%PLUG_HOME%',
|
||||||
\ ['@echo off', ':: Generated by vim-plug', ':: '.strftime("%c"), '',
|
\ ['@echo off', ':: Generated by vim-plug', ':: '.strftime("%c"), '',
|
||||||
\ ':: Make sure to PlugUpdate first', '', 'set PLUG_HOME='.s:esc(home)]] :
|
\ ':: Make sure to PlugUpdate first', '', 'set PLUG_HOME='.home]] :
|
||||||
\ ['sh', '$PLUG_HOME',
|
\ ['sh', '$PLUG_HOME',
|
||||||
\ ['#!/bin/sh', '# Generated by vim-plug', '# '.strftime("%c"), '',
|
\ ['#!/bin/sh', '# Generated by vim-plug', '# '.strftime("%c"), '',
|
||||||
\ 'vim +PlugUpdate +qa', '', 'PLUG_HOME='.s:esc(home)]]
|
\ 'vim +PlugUpdate +qa', '', 'PLUG_HOME='.s:esc(home)]]
|
||||||
@ -1985,7 +1985,7 @@ function! s:snapshot(...) abort
|
|||||||
let sha = s:system_chomp('git rev-parse --short HEAD', dir)
|
let sha = s:system_chomp('git rev-parse --short HEAD', dir)
|
||||||
if !empty(sha)
|
if !empty(sha)
|
||||||
call append(anchor, printf('cd %s && git reset --hard %s',
|
call append(anchor, printf('cd %s && git reset --hard %s',
|
||||||
\ substitute(dir, '^'.g:plug_home, var, ''), sha))
|
\ substitute(dir, '^\V'.escape(g:plug_home, '\'), var, ''), sha))
|
||||||
redraw
|
redraw
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
Loading…
Reference in New Issue
Block a user