Tom Lith wrote:

> Let's assume files is ['foo(bar).txt']. Let's try
> 
>     :exec 'grep' fnameescape(join(files))
> 
> This throws an error (on ubuntu 12.04).
> 
> The following solves the problem:
> 
>     :exec 'grep' escape(fnameescape(join(files)), '()')
> 
> I think though this shouldn't be necessary since it somehow undermines
> the usefulness of fnameescape(). IMHO fnameescape() should also escape
> '()', shoudn't it?

fnameescape() is for Vim commands.  Since "grep" executes an external
command you need to use shellescape().  And that does handle parens.

        :exe '!ls ' . shellescape('asdf(asdf)asdf')
        ls: cannot access asdf(asdf)asdf: No such file or directory

-- 
Proofread carefully to see if you any words out.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

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