Steal Windows shell escaping from dispatch.vim
This commit is contained in:
parent
b139d72da4
commit
15450eff27
@ -34,7 +34,14 @@ function! s:shellesc(arg) abort
|
|||||||
if a:arg =~ '^[A-Za-z0-9_/.-]\+$'
|
if a:arg =~ '^[A-Za-z0-9_/.-]\+$'
|
||||||
return a:arg
|
return a:arg
|
||||||
elseif &shell =~# 'cmd'
|
elseif &shell =~# 'cmd'
|
||||||
return '"'.substitute(substitute(a:arg, '"', '""""', 'g'), '%', '"%"', 'g').'"'
|
if &shellxquote ==# '"'
|
||||||
|
return '"' . substitute(a:arg, '"', '""', 'g') . '"'
|
||||||
|
else
|
||||||
|
let esc = exists('+shellxescape') ? &shellxescape : '"&|<>()@^'
|
||||||
|
return &shellxquote .
|
||||||
|
\ substitute(a:arg, '['.esc.']', '^&', 'g') .
|
||||||
|
\ get({'(': ')', '"(': ')"'}, &shellxquote, &shellxquote)
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
let escaped = shellescape(a:arg)
|
let escaped = shellescape(a:arg)
|
||||||
if &shell =~# 'sh' && &shell !~# 'csh'
|
if &shell =~# 'sh' && &shell !~# 'csh'
|
||||||
|
Loading…
Reference in New Issue
Block a user