diff --git a/plug.vim b/plug.vim index 40cffe68..66ef95ea 100644 --- a/plug.vim +++ b/plug.vim @@ -1980,11 +1980,18 @@ function! s:shellesc_cmd(arg) return '^"'.substitute(escaped, '\(\\\+\)$', '\1\1', '').'^"' endfunction +function! s:shellesc_ps1(arg) + return "'".substitute(escape(a:arg, '\"'), "'", "''", 'g')."'" +endfunction + function! s:shellesc(arg, ...) 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) endif + if shell =~# 'powershell\.exe$' + return s:shellesc_ps1(a:arg) + endif return shellescape(a:arg) endfunction