mirror of
https://github.com/neovim/neovim.git
synced 2025-09-11 22:08:18 +00:00
win: default shellxescape, shellxquote to empty
Calling cmd.exe in Windows follows a very different pattern from Vim. The primary difference is that Vim does a nested call to cmd.exe, e.g. the following call in Vim system('echo a 2>&1') spawns the following processes "C:\Program Files (x86)\Vim\vim80\vimrun" -s C:\Windows\system32\cmd.exe /c (echo a 2^>^&1 ^>C:\Users\dummy\AppData\Local\Temp\VIoC169.tmp 2^>^&1) C:\Windows\system32\cmd.exe /c C:\Windows\system32\cmd.exe /c (echo a 2^>^&1 ^>C:\Users\dummy\AppData\Local\Temp\VIo3C6C.tmp 2^>^&1) C:\Windows\system32\cmd.exe /c (echo a 2>&1 >C:\Users\dummy\AppData\Local\Temp\VIo3C6C.tmp 2>&1) The escaping with ^ is needed because cmd.exe calls itself and needs to preserve the special metacharacters for the last call. However in nvim no nested call is made, system('') spawns a single cmd.exe process. Setting shellxescape to "" disables escaping with ^. The previous default for shellxquote=( wrapped any command in parenthesis, in Vim this is more meaningful due to the use of tempfiles to store the output and redirection (also see &shellquote). There is a slight benefit in having the default be empty because some expressions that run in console will not run within parens e.g. due to unbalanced double quotes system('echo "a b')
This commit is contained in:

committed by
Justin M. Keyes

parent
f3cc843755
commit
d31d177a0c
@@ -2077,11 +2077,7 @@ return {
|
||||
secure=true,
|
||||
vi_def=true,
|
||||
varname='p_sxq',
|
||||
defaults={
|
||||
condition='WIN32',
|
||||
if_true={vi="("},
|
||||
if_false={vi=""}
|
||||
}
|
||||
defaults={if_true={vi=""}}
|
||||
},
|
||||
{
|
||||
full_name='shellxescape', abbreviation='sxe',
|
||||
@@ -2089,11 +2085,7 @@ return {
|
||||
secure=true,
|
||||
vi_def=true,
|
||||
varname='p_sxe',
|
||||
defaults={
|
||||
condition='WIN32',
|
||||
if_true={vi='"&|<>()@^'},
|
||||
if_false={vi=""}
|
||||
}
|
||||
defaults={if_true={vi=""}}
|
||||
},
|
||||
{
|
||||
full_name='shiftround', abbreviation='sr',
|
||||
|
Reference in New Issue
Block a user