mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
updated for version 7.3.443
Problem: MS-Windows: 'shcf' and 'shellxquote' defaults are not very good. Solution: Make a better guess when 'shell' is set to "cmd.exe". (Ben Fritz)
This commit is contained in:
parent
60542ac9fd
commit
a64ba220f0
@ -6041,8 +6041,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
|
|
||||||
*'shellxquote'* *'sxq'*
|
*'shellxquote'* *'sxq'*
|
||||||
'shellxquote' 'sxq' string (default: "";
|
'shellxquote' 'sxq' string (default: "";
|
||||||
for Win32, when 'shell' contains "sh"
|
for Win32, when 'shell' is cmd.exe or
|
||||||
somewhere: "\""
|
contains "sh" somewhere: "\""
|
||||||
for Unix, when using system(): "\"")
|
for Unix, when using system(): "\"")
|
||||||
global
|
global
|
||||||
{not in Vi}
|
{not in Vi}
|
||||||
@ -6050,11 +6050,12 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
the "!" and ":!" commands. Includes the redirection. See
|
the "!" and ":!" commands. Includes the redirection. See
|
||||||
'shellquote' to exclude the redirection. It's probably not useful
|
'shellquote' to exclude the redirection. It's probably not useful
|
||||||
to set both options.
|
to set both options.
|
||||||
This is an empty string by default. Known to be useful for
|
This is an empty string by default on most systems, but is known to be
|
||||||
third-party shells when using the Win32 version, such as the MKS Korn
|
useful for on Win32 version, either for cmd.exe which automatically
|
||||||
Shell or bash, where it should be "\"". The default is adjusted
|
strips off the first and last quote on a command, or 3rd-party shells
|
||||||
according the value of 'shell', to reduce the need to set this option
|
such as the MKS Korn Shell or bash, where it should be "\"". The
|
||||||
by the user. See |dos-shell|.
|
default is adjusted according the value of 'shell', to reduce the need
|
||||||
|
to set this option by the user. See |dos-shell|.
|
||||||
This option cannot be set from a |modeline| or in the |sandbox|, for
|
This option cannot be set from a |modeline| or in the |sandbox|, for
|
||||||
security reasons.
|
security reasons.
|
||||||
|
|
||||||
|
39
src/option.c
39
src/option.c
@ -3883,7 +3883,8 @@ set_init_3()
|
|||||||
|
|
||||||
#if defined(MSDOS) || defined(WIN3264) || defined(OS2)
|
#if defined(MSDOS) || defined(WIN3264) || defined(OS2)
|
||||||
/*
|
/*
|
||||||
* Set 'shellcmdflag and 'shellquote' depending on the 'shell' option.
|
* Set 'shellcmdflag', 'shellxquote', and 'shellquote' depending on the
|
||||||
|
* 'shell' option.
|
||||||
* This is done after other initializations, where 'shell' might have been
|
* This is done after other initializations, where 'shell' might have been
|
||||||
* set, but only if they have not been set before. Default for p_shcf is
|
* set, but only if they have not been set before. Default for p_shcf is
|
||||||
* "/c", for p_shq is "". For "sh" like shells it is changed here to
|
* "/c", for p_shq is "". For "sh" like shells it is changed here to
|
||||||
@ -3920,6 +3921,42 @@ set_init_3()
|
|||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
else if (strstr((char *)gettail(p_sh), "cmd.exe") != NULL)
|
||||||
|
{
|
||||||
|
int idx3;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* cmd.exe on Windows will strip the first and last double quote given
|
||||||
|
* on the command line, e.g. most of the time things like:
|
||||||
|
* cmd /c "my path/to/echo" "my args to echo"
|
||||||
|
* become:
|
||||||
|
* my path/to/echo" "my args to echo
|
||||||
|
* when executed.
|
||||||
|
*
|
||||||
|
* To avoid this, use the /s argument in addition to /c to force the
|
||||||
|
* stripping behavior, and also set shellxquote to automatically
|
||||||
|
* surround the entire command in quotes (which get stripped as
|
||||||
|
* noted).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Set shellxquote default to add the quotes to be stripped. */
|
||||||
|
idx3 = findoption((char_u *)"sxq");
|
||||||
|
if (idx3 >= 0 && !(options[idx3].flags & P_WAS_SET))
|
||||||
|
{
|
||||||
|
p_sxq = (char_u *)"\"";
|
||||||
|
options[idx3].def_val[VI_DEFAULT] = p_sxq;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set shellcmdflag default to always strip the quotes, note the order
|
||||||
|
* between /s and /c is important or cmd.exe will treat the /s as part
|
||||||
|
* of the command to be executed. */
|
||||||
|
idx3 = findoption((char_u *)"shcf");
|
||||||
|
if (idx3 >= 0 && !(options[idx3].flags & P_WAS_SET))
|
||||||
|
{
|
||||||
|
p_shcf = (char_u *)"/s /c";
|
||||||
|
options[idx3].def_val[VI_DEFAULT] = p_shcf;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_TITLE
|
#ifdef FEAT_TITLE
|
||||||
|
@ -714,6 +714,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
443,
|
||||||
/**/
|
/**/
|
||||||
442,
|
442,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user