On Feb 19, 11:17 pm, mattn <[email protected]> wrote:
> >  However
> > :echo system('type mercurial.ini ^| findstr gvim')
>
> It seems degrade :-(
> It should be escaped automatically. If new option should be needed, it must
> behave before 7.4.443 I think.
>

Yes, the idea of 7.3.443 was to fix commands like:

:!"exe with spaces.exe" "arg with spaces"

which Vim executes as:

cmd /c "exe with spaces.exe" "arg with spaces"

which then executes in the shell as:

exe with spaces.exe" "arg with spaces

But unfortunately, special characters cause problems, e.g.
:!somecmd "arg & morearg"

As discussed in response to 7.3.443, the way to correctly pass all
strings would be to escape special characters and group all commands
before passing to the cmd.exe shell, e.g.

cmd /c (^"cmd with spaces.exe^" ^"arg ^& morearg^" ^| somethingelse)

In this way, the invoking shell sees one long string of text (all
special characters escaped), which it then passes to a new cmd.exe to
parse as intended.

Vim should automatically add the ^ escapes because the user should not
be expected to know to do this.

But, my point in needing a new option, is that if the user explicitly
sets shellxquote back to " or even an empty string, adding the escapes
will cause problems. E.g.

:!echo "A&B"

will currently work if shellxquote is empty, but if we add
unconditional automatic escaping, it will instead echo "A^&B" in a
shell window.

So I propose that we add another option which defaults to escaping all
special characters with ^ if shellxquote is ( and shell is cmd.exe
(both the default).

-- 
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

Raspunde prin e-mail lui