@@ -794,9 +794,7 @@ endfunction
794
794
795
795
function ! s: chsh (swap)
796
796
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
800
798
set shell = sh shellredir = >% s \ 2 >&1
801
799
endif
802
800
return prev
@@ -811,7 +809,7 @@ function! s:bang(cmd, ...)
811
809
if s: is_win
812
810
let batchfile = tempname ().' .bat'
813
811
call writefile ([" @echo off\r " , cmd . " \r " ], batchfile)
814
- let cmd = s: shellesc (batchfile)
812
+ let cmd = s: shellesc (expand ( batchfile) )
815
813
endif
816
814
let g: _plug_bang = (s: is_win && has (' gui_running' ) ? ' silent ' : ' ' ).' !' .escape (cmd, ' #!%' )
817
815
execute " normal! :execute g:_plug_bang\<cr>\<cr> "
@@ -1210,7 +1208,7 @@ function! s:spawn(name, cmd, opts)
1210
1208
let cmd = has_key (a: opts , ' dir' ) ? s: with_cd (a: cmd , a: opts .dir ) : a: cmd
1211
1209
if ! empty (job.batchfile)
1212
1210
call writefile ([" @echo off\r " , cmd . " \r " ], job.batchfile)
1213
- let cmd = s: shellesc (job.batchfile)
1211
+ let cmd = s: shellesc (expand ( job.batchfile) )
1214
1212
endif
1215
1213
let argv = add (s: is_win ? [' cmd' , ' /c' ] : [' sh' , ' -c' ], cmd)
1216
1214
@@ -2037,7 +2035,7 @@ function! s:system(cmd, ...)
2037
2035
if s: is_win
2038
2036
let batchfile = tempname ().' .bat'
2039
2037
call writefile ([" @echo off\r " , cmd . " \r " ], batchfile)
2040
- let cmd = s: shellesc (batchfile)
2038
+ let cmd = s: shellesc (expand ( batchfile) )
2041
2039
endif
2042
2040
return system (cmd)
2043
2041
finally
@@ -2371,7 +2369,7 @@ function! s:preview_commit()
2371
2369
if s: is_win
2372
2370
let batchfile = tempname ().' .bat'
2373
2371
call writefile ([" @echo off\r " , cmd . " \r " ], batchfile)
2374
- let cmd = batchfile
2372
+ let cmd = expand ( batchfile)
2375
2373
endif
2376
2374
execute ' silent %!' cmd
2377
2375
finally
0 commit comments