updated for version 7.3.445
Problem: Can't properly escape commands for cmd.exe.
Solution: Default 'shellxquote' to '('. Append ')' to make '(command)'.
No need to use "/s" for 'shellcmdflag'.
diff --git a/src/option.c b/src/option.c
index 04db07b..cac031e 100644
--- a/src/option.c
+++ b/src/option.c
@@ -3933,27 +3933,22 @@
* 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).
+ * To avoid this, set shellxquote to surround the command in
+ * parenthesis. This appears to make most commands work, without
+ * breaking commands that worked previously, such as
+ * '"path with spaces/cmd" "a&b"'.
*/
-
- /* 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 *)"\"";
+ 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";
+ p_shcf = (char_u *)"/c";
options[idx3].def_val[VI_DEFAULT] = p_shcf;
}
}