On Saturday, July 5, 2014 12:42:19 PM UTC+4, lith wrote:
> Hi!
>
> Let's assume files is ['foo(bar).txt']. Let's try
>
> :exec 'grep' fnameescape(join(files))
Are you sure you have written exactly what you want? If you assume files is
['a', 'b'] and these files exist,
:execute 'grep' fnameescape(join(files))
will not work, neither will work correct
:execute 'grep' shellescape(join(files), 1)
: both will try to use a single file named `a b`.
You need
:execute 'grep' join(map(files, 'shellescape(v:val, 1)'))
>
> 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?
--
--
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.