It seems that quoting arguments of shebang command depend on shellslash.
but on windows, cmd.exe or command.com can't treat single quote.
--- test.vimrc ---
set nocompatible
set shellslash
----------------------
C:\> vim -u test.vimrc -U NONE
:e http://www.google.com/
I got empty buffer. it cause that vim call following command in
mch_call_shell().
----------------------
curl -o 'C:/DOCUME~1/MATSUM~1/LOCALS~1/Temp/VIAD5.tmp' 'http://www.google.com'
curl: (6) Could not resolve host: curl; Host not found
curl: (1) Unsupported protocol: 'http
----------------------
Below is a patch for fixing this problem. Please check and include.
Index: src/misc2.c
===================================================================
--- src/misc2.c (revision 1318)
+++ src/misc2.c (working copy)
@@ -1286,7 +1286,18 @@
char_u *escaped_string;
int l;
int csh_like;
+ int ssl = p_ssl;
+# if defined(WIN32) || defined(WIN16) || defined(DOS)
+ /* cmd.exe or command.com can't treat single quote. */
+ char_u *comspec;
+
+ comspec = mch_getenv("COMSPEC");
+ if (comspec && STRNCMP(comspec, p_sh, STRLEN(comspec)) == 0) {
+ ssl = 0;
+ }
+#endif
+
/* Only csh and similar shells expand '!' within single quotes. For sh and
* the like we must not put a backslash before it, it will be taken
* literally. If do_special is set the '!' will be escaped twice.
@@ -1298,7 +1309,7 @@
for (p = string; *p != NUL; mb_ptr_adv(p))
{
# if defined(WIN32) || defined(WIN16) || defined(DOS)
- if (!p_ssl)
+ if (!ssl)
{
if (*p == '"')
++length; /* " -> "" */
@@ -1328,7 +1339,7 @@
/* add opening quote */
# if defined(WIN32) || defined(WIN16) || defined(DOS)
- if (!p_ssl)
+ if (!ssl)
*d++ = '"';
else
# endif
@@ -1337,7 +1348,7 @@
for (p = string; *p != NUL; )
{
# if defined(WIN32) || defined(WIN16) || defined(DOS)
- if (!p_ssl)
+ if (!ssl)
{
if (*p == '"')
{
@@ -1378,7 +1389,7 @@
/* add terminating quote and finish with a NUL */
# if defined(WIN32) || defined(WIN16) || defined(DOS)
- if (!p_ssl)
+ if (!ssl)
*d++ = '"';
else
# endif
--
- Yasuhiro Matsumoto
cmd.exe and command.com also can't handle the forward slash as a path
separator, so you shouldn't set 'sellslash' if you're using them. The
single quote is to be used when using a Unix-like shell on Windows (and,
unlike what you seem to be assuming, a Unix-like shell can be used on
top of cmd.exe or command.com, in which case $COMSPEC will be set to the
Dos/Windows shell, not the Unix-like shell).
Best regards,
Tony.
--
FATHER: You killed eight wedding guests in all!
LAUNCELOT: Er, Well ... the thing is ... I thought your son was a lady.
FATHER: I can understand that.
"Monty Python and the Holy Grail" PYTHON (MONTY)
PICTURES LTD
cmd.exe and command.com also can't handle the forward slash as a path
Hmm.
No. cmd.exe can treat the forward slash as path separator. And
shellslash had working good on windows with older version.
I guess this is a bug or grade down.
still more, netrw can't treat shellshash correctly on latest version.
the buffer name will be broken like a following with noshellslash.
http:\\www.google.com\
Many users hope to use shellslash on windows.
Best Regards.
--
- Yasuhiro Matsumoto
Or how about below?
(check that COMSPEC is cmd.exe)
Index: src/misc2.c
===================================================================
--- src/misc2.c (revision 1318)
+++ src/misc2.c (working copy)
@@ -1286,7 +1286,19 @@
char_u *escaped_string;
int l;
int csh_like;
+ int ssl = p_ssl;
+# if defined(WIN32) || defined(WIN16) || defined(DOS)
+ /* cmd.exe or command.com can't treat single quote. */
+ char_u *comspec;
+
+ comspec = mch_getenv("COMSPEC");
+ if (comspec && STRICMP((char *)gettail(comspec), "cmd.exe") == 0
+ && STRNCMP(comspec, p_sh, STRLEN(comspec)) == 0) {
+ ssl = 0;
+ }
+#endif
+
/* Only csh and similar shells expand '!' within single quotes. For sh and
* the like we must not put a backslash before it, it will be taken
* literally. If do_special is set the '!' will be escaped twice.
@@ -1298,7 +1310,7 @@
for (p = string; *p != NUL; mb_ptr_adv(p))
{
# if defined(WIN32) || defined(WIN16) || defined(DOS)
- if (!p_ssl)
+ if (!ssl)
{
if (*p == '"')
++length; /* " -> "" */
@@ -1328,7 +1340,7 @@
/* add opening quote */
# if defined(WIN32) || defined(WIN16) || defined(DOS)
- if (!p_ssl)
+ if (!ssl)
*d++ = '"';
else
# endif
@@ -1337,7 +1349,7 @@
for (p = string; *p != NUL; )
{
# if defined(WIN32) || defined(WIN16) || defined(DOS)
- if (!p_ssl)
+ if (!ssl)
{
if (*p == '"')
{
@@ -1378,7 +1390,7 @@
Or how about below?
(check that COMSPEC is cmd.exe)
Index: src/misc2.c
===================================================================
--- src/misc2.c (revision 1318)
+++ src/misc2.c (working copy)
@@ -1286,7 +1286,19 @@
char_u *escaped_string;
int l;
int csh_like;
+ int ssl = p_ssl;
+# if defined(WIN32) || defined(WIN16) || defined(DOS)
+ /* cmd.exe or command.com can't treat single quote. */
+ char_u *comspec;
+
+ comspec = mch_getenv("COMSPEC");
+ if (comspec && STRICMP((char *)gettail(comspec), "cmd.exe") == 0
+ && STRNCMP(comspec, p_sh, STRLEN(comspec)) == 0) {
+ ssl = 0;
+ }
+#endif
+
/* Only csh and similar shells expand '!' within single quotes. For sh and
* the like we must not put a backslash before it, it will be taken
* literally. If do_special is set the '!' will be escaped twice.
@@ -1298,7 +1310,7 @@
for (p = string; *p != NUL; mb_ptr_adv(p))
{
# if defined(WIN32) || defined(WIN16) || defined(DOS)
- if (!p_ssl)
+ if (!ssl)
{
if (*p == '"')
++length; /* " -> "" */
@@ -1328,7 +1340,7 @@
/* add opening quote */
# if defined(WIN32) || defined(WIN16) || defined(DOS)
- if (!p_ssl)
+ if (!ssl)
*d++ = '"';
else
# endif
@@ -1337,7 +1349,7 @@
for (p = string; *p != NUL; )
{
# if defined(WIN32) || defined(WIN16) || defined(DOS)
- if (!p_ssl)
+ if (!ssl)
{
if (*p == '"')
{
@@ -1378,7 +1390,7 @@
Well, actually in DOS with COMMAND.COM you had to change a byte
somewhere in DOS (in segment 40h IIRC) to have / recognized as a path
separator (instead of \ ) and - as a command-line switch prefix (instead
of / ); but many programs didn't check that byte (e.g. when interpreting
paths and options passed on the command-line) so it was better to leave
it at the default.
Best regards,
Tony.
--
FATHER: You only killed the bride's father - that's all -
LAUNCELOT: Oh dear, I didn't really mean to...
FATHER: Didn't mean to? You put your sword right through his head!
LAUNCELOT: Gosh - Is he all right?
We didn't think of people using 'shell' set to "cmd.exe" and also
setting 'shellslash'. OK, so some people do use that.
I wonder why you get the value of COMSPEC? Isn't it sufficient to
compare the tail of 'shell' to "cmd.exe"? We could also check
"command.com", just in case. And I think "cmd", without ".exe", also
works.
--
For society, it's probably a good thing that engineers value function over
appearance. For example, you wouldn't want engineers to build nuclear power
plants that only _look_ like they would keep all the radiation inside.
(Scott Adams - The Dilbert principle)
/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Then there are third-party shells like 4NT.EXE etc. Couldn't you just
check that the value of $SHELL (minus a possible case-insentitive .exe
or .com at the end if there is one) ends in "sh" (indicating a Unix-like
shell) or in anything else (indicating a Dos-like shell), and maybe
fallback to $COMSPEC if $SHELL is unset?
Best regards,
Tony.
--
Dear Mister Language Person: What is the purpose of the apostrophe?
Answer: The apostrophe is used mainly in hand-lettered small business
signs to alert the reader than an "S" is coming up at the end of a
word, as in: WE DO NOT EXCEPT PERSONAL CHECK'S, or: NOT RESPONSIBLE FOR
ANY ITEM'S. Another important grammar concept to bear in mind when
creating hand- lettered small-business signs is that you should put
quotation marks around random words for decoration, as in "TRY" OUR HOT
DOG'S, or even TRY "OUR" HOT DOG'S.
-- Dave Barry, "Tips for Writer's"
--
- Yasuhiro Matsumoto
--
- Yasuhiro Matsumoto
I hope your working for this topic. I guess that some or many people
in the world who use vim on windows are confusing.
Thanks.
- Yasuhiro Matsumoto
--
- Yasuhiro Matsumoto
I hope your working for this topic. I guess that some or many people
in the world who use vim on windows are confusing.
Thanks.
- Yasuhiro Matsumoto
On Thu, Jan 15, 2009 at 8:06 AM, Yasuhiro MATSUMOTO <matt...@gmail.com> wrote:
--
- Yasuhiro Matsumoto
Please bottom post on this list. Quote a small (relevant) part
of the message you are replying to, and put your text underneath.
See
http://groups.google.com/group/vim_use/web/vim-information
John
> I hope your working for this topic. I guess that some or many people
> in the world who use vim on windows are confusing.
It's in the todo list, but it will take a while before I get to it.
If you respond to a message, please put your text below what you are
replying to or delete it, like I did here.
--
An easy way to determine if you have enough teamwork to be doomed is simply to
measure how long it takes from the time you decide to go to lunch together
until the time you actually eat.
I see. i'm having misgivings whether some people make bad-know-how
hack for this problem.
> If you respond to a message, please put your text below what you are
> replying to or delete it, like I did here.
Ah, sorry.
--
- Yasuhiro Matsumoto