Support powershell

This commit is contained in:
Jan Edmund Lazo 2019-08-03 17:33:53 -04:00
parent 9382063860
commit 35cfe4b16f

View File

@ -1980,11 +1980,18 @@ function! s:shellesc_cmd(arg)
return '^"'.substitute(escaped, '\(\\\+\)$', '\1\1', '').'^"' return '^"'.substitute(escaped, '\(\\\+\)$', '\1\1', '').'^"'
endfunction endfunction
function! s:shellesc_ps1(arg)
return "'".substitute(escape(a:arg, '\"'), "'", "''", 'g')."'"
endfunction
function! s:shellesc(arg, ...) function! s:shellesc(arg, ...)
let shell = get(a:000, 0, s:is_win ? 'cmd.exe' : 'sh') let shell = get(a:000, 0, s:is_win ? 'cmd.exe' : 'sh')
if shell =~# 'cmd.exe$' if shell =~# 'cmd\.exe$'
return s:shellesc_cmd(a:arg) return s:shellesc_cmd(a:arg)
endif endif
if shell =~# 'powershell\.exe$'
return s:shellesc_ps1(a:arg)
endif
return shellescape(a:arg) return shellescape(a:arg)
endfunction endfunction