I don't think it is worth the trouble insisting to pass % to an external
command instead of passing "%". This will solve all the difficuties, as
long as we make sure that vim escapes no character.

On 11/11/07 05:26, Tony Mechelynck wrote:
> Zvi Har'El wrote:
>   
>> I think you should not escape any characters. You don't have to guess 
>> which characters are special for the particular shell. Just give the 
>> original name as you received it.
>>
>> On 10/11/07 23:28, Bram Moolenaar wrote:
>>
>>     
>>> Zvi Har'El wrote:
>>>
>>>   
>>>       
>>>> I feel vim has a bug in the case the name the file contain parentheses.
>>>> The "%" string contains in this case  backslashes.  For example:
>>>>
>>>>
>>>> $ls -l 'JVs America (article).html'
>>>> -rw-r--r-- 1 rl gileadweb 31426 2007-11-10 19:16 JVs America (article).htm
>>>>
>>>>
>>>>  $ vi +'!/bin/echo "%"' +x -e -s 'JVs America (article).html'
>>>> JVs America \(article\).html
>>>>
>>>>
>>>> $ vi +'!/bin/ls "%"' +x -e -s 'JVs America (article).html'
>>>>
>>>> /bin/ls: JVs America \(article\).html: No such file or directory
>>>>     
>>>>         
>>> This is indeed inconsistent.  Vim should either escape the space as
>>> well, so that you can leave out the quotes, or not escape special
>>> characters, so that you can use quotes.  I'm not sure which one is the
>>> best solution.
>>>       
>
> Currently, when doing file name completion in the shell, bash will add 
> escaping backslashes and pass the whole name as one argv[] element. However,
>
>
>       touch 'a (b) c'
>       vim +'/bin/ls %' +x -e -s a<Tab>
>
> which the shell completes to
>
>       vim +'/bin/ls %' +x -e -s a\ \(b\)\ c
>
> doesn't work:
> /bin/ls: cannot access a: No such file or directory
> /bin/ls: cannot access (b): No such file or directory
> /bin/ls: cannot access c: No such file or directory
>
> What does work is
>
>       vim +'/bin/ls %' +x -e -s 'a\ (b)\ c'
>
> which replies
>
> a (b) c
>
> This is paradoxical, since in interactive mode
>
>       vim 'a\ (b)\ c'
>
> displays the file name as
>
> a\ (b)\ c
>
> on the status line, then
>
>       :!ls %
>
> returns
>
> a (b) c
>
> which is apparently not the file being edited, while
>
>       vim a\ \(b\)\ c
>
> (or "vim a<Tab>" with bash completion) shows
>
> a (b) c
>
> but
>
>       :!ls %
>
> replies
>
> ls: cannot access a: No such file or directory
> ls: cannot access (b): No such file or directory
> ls: cannot access c: No such file or directory
>
> shell returned 2
>
> press ENTER or type command to continue
>
>
>
> IMHO, passing % to an external :! command ought to work, but is it feasible? 
> Can Vim know which characters must be backslash-escaped in which shell? On my 
> Linux system there are at least sh, ash, bash, csh, tcsh, ksh, zsh.
>
>
> Best regards,
> Tony.
>   

-- 
Dr. Zvi Har'El      mailto:[EMAIL PROTECTED]    Department of Mathematics
tel:+972-54-4227607                  Technion - Israel Institute of Technology
fax:+972-4-8293388  http://www.math.technion.ac.il/~rl/    Haifa 32000, ISRAEL
"If you can't say somethin' nice, don't say nothin' at all." -- Thumper (1942)


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui