On 11-Mar-2014 15:14 +0100, Ben Fritz wrote:

> On Tuesday, March 4, 2014 1:15:40 AM UTC-6, Gary Johnson wrote:
>>
>>
>> Using a GUI file manager, I opened this file with gvim.  I made some
>>
>> changes to it, then tried comparing the changed buffer with the
>>
>> copy on disk with this command which I have used for years:
>>
>>
>>
>>     :w !diff "%" -
>>
>>
>>
>> The result surprised me.
>>
>>
>>
>>     diff: Dropbox/vimfiles/filetype \(toucan's conflicted copy 
>> 2014-03-01\).vim: No such file or directory
>>
>>
>>
>>     shell returned 2
>>
>>
>>
>> However, if instead I typed
>>
>>
>>
>>     :w !diff "^R%" -
>>
>>
>>
>> where ^R means Ctrl-R, the command became
>>
>>
>>
>>     :w !diff "Dropbox/vimfiles/filetype (toucan's conflicted copy 
>> 2014-03-01).vim" -
>>
>>
>>
>> and worked fine.
>>
>>
>>
> 
> Isn't this situation what shellescape() is designed for?
> 
> That's not saying shellescape() will work, but I think it's supposed
> to work, unlike using a bare % which should always work for internal
> Vim commands but will only work by accident in external commands.

No, shellescape() would be used in a mapping / command, like this:
shellescape(expand('%'), 1). With the 1 flag (for use with :!), a
literal % is properly escaped to \% so that Vim's special handling does
not apply.

% is handy for interactive use, like :!perl %

-- regards, ingo

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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui