Skip to content

Commit 226d6ab

Browse files
janlazojunegunn
authored andcommitted
Don't override shell on Windows (#856)
Assume that the user set the shell options correctly before running vim-plug so that the user can use bash or powershell as their shell. Close #815
1 parent fddbcb8 commit 226d6ab

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

plug.vim

+5-7
Original file line numberDiff line numberDiff line change
@@ -794,9 +794,7 @@ endfunction
794794

795795
function! s:chsh(swap)
796796
let prev = [&shell, &shellcmdflag, &shellredir]
797-
if s:is_win
798-
set shell=cmd.exe shellcmdflag=/c shellredir=>%s\ 2>&1
799-
elseif a:swap
797+
if !s:is_win && a:swap
800798
set shell=sh shellredir=>%s\ 2>&1
801799
endif
802800
return prev
@@ -811,7 +809,7 @@ function! s:bang(cmd, ...)
811809
if s:is_win
812810
let batchfile = tempname().'.bat'
813811
call writefile(["@echo off\r", cmd . "\r"], batchfile)
814-
let cmd = s:shellesc(batchfile)
812+
let cmd = s:shellesc(expand(batchfile))
815813
endif
816814
let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%')
817815
execute "normal! :execute g:_plug_bang\<cr>\<cr>"
@@ -1210,7 +1208,7 @@ function! s:spawn(name, cmd, opts)
12101208
let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd
12111209
if !empty(job.batchfile)
12121210
call writefile(["@echo off\r", cmd . "\r"], job.batchfile)
1213-
let cmd = s:shellesc(job.batchfile)
1211+
let cmd = s:shellesc(expand(job.batchfile))
12141212
endif
12151213
let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd)
12161214

@@ -2037,7 +2035,7 @@ function! s:system(cmd, ...)
20372035
if s:is_win
20382036
let batchfile = tempname().'.bat'
20392037
call writefile(["@echo off\r", cmd . "\r"], batchfile)
2040-
let cmd = s:shellesc(batchfile)
2038+
let cmd = s:shellesc(expand(batchfile))
20412039
endif
20422040
return system(cmd)
20432041
finally
@@ -2371,7 +2369,7 @@ function! s:preview_commit()
23712369
if s:is_win
23722370
let batchfile = tempname().'.bat'
23732371
call writefile(["@echo off\r", cmd . "\r"], batchfile)
2374-
let cmd = batchfile
2372+
let cmd = expand(batchfile)
23752373
endif
23762374
execute 'silent %!' cmd
23772375
finally

0 commit comments

Comments
 (0)