On Feb 23, 8:01 pm, mattn <[email protected]> wrote:
> As you know, ':!start' is imitation of 'start' command in cmd.exe. So I'm
> thinking vim's behavor should be same as cmd's one.
> If typing below in cmd.exe, it works correctly.
>
I agree. Now, note, with 7.3.456:
C:\>start cmd /k (echo A^^^&B ^& pause)
A new window pops up, "A&B" is echoed at the top, and it says "Press
any key to continue..."
:set shellxquote=(:
:!start cmd /k (echo A^^^&B ^& pause)
A new window pops up, and "A^&B & pause" is echoed at the top.
:!start cmd /k (echo A^&B & pause)
A new window pops up, "A&B" is echoed at the top, and it says "Press
any key to continue..."
:set shellxquote="
:!start cmd /k (echo A^^^&B ^& pause)
A new window pops up, "A&B" is echoed at the top, and it says "Press
any key to continue..."
What should a user expect? That :!start acts like the "start" command
in a cmd.exe shell? Currently, it does not with shellxquote=(. Or
should the user expect that :!start invokes the command with the given
literal arguments as cmd.exe would have passed in after doing its own
processing of escaped characters, etc.? I think conceptually the
former is easier to grasp (and to experiment with outside of Vim to
get right). But, quoting and escaping in cmd.exe is so convoluted (who
knew?) that I suppose either way is acceptable, as long as we provide
an explanation and examples in the :help.
I don't like that shellxquote=" and shellxquote=( have such different
behaviors in this case.
Here's an interesting test:
:!if 1==0 (echo A^&B & pause) else (echo B^&A & echo C^|D & pause)
works as expected
:echo system('if 1==0 (echo A^&B) else (echo B^&A & echo C^|D)')
works as expected
:!start cmd /k (if 1==0 (echo A^&B) else (echo B^&A & echo C^|D))
Works as *intended* with shellxquote=( but not as one might expect if
one tries the same command from a cmd.exe shell
Does NOT work as intended with shellxquote=", but this is to be
expected if the command is compared to a cmd.exe shell.
Escaping the !start command with ^ characters makes it work as
intended and expected for shellxquote=" but breaks shellxquote=(.
Arguably it is easier for the user if we allow them to use mostly the
same string for :!start cmd /c as they do for system() and :!cmd, but
pedantically it's wrong.
Should we just update the help and call it good or try to make :!start
actually behave like "start" from a cmd.exe shell?
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php