Hi,

[Quoting re-ordered. Please bottom-post on this list.]

Shabunc schrieb:
> 
> On 22 ноя, 22:22, Christian Brabandt <[email protected]> wrote:
>>
>> On So, 22 Nov 2009, Shagen Ogandzhanjan wrote:
>>
>>> The task is to fetch all files matching pattern (for instance, matching some
>>> file extension)
>>> and to place all into the quickfix list (or location list, I don't mind).
>>
>>> The only way personally I know is to write something like this:
>>>  *:vim /\%1l/j **/*.xml*
>>
>> How about
>> :cexpr glob("**/*.txt")
>>
>> See the help for :cexpr. You can also use :lgetexpr and use the location
>> list instead or use :cad to add the result to the quickfix list.
>
> Christian, first of all, thanks for this tips.
> But I guess I haven't explained my good intentions clear enough)
> If one writes :cexpr glob("**/*.txt"), he'll get a quickfix list with
> output like this:
>
> 1 || text1.txt
> 2 || text2.txt
> 3 || text3.txt
>
> and so on.
> This output looks great and trustworthy but actually (if I'm not
> mistaken)
> there are still some issues.
>
> we can't choose file and press enter, neither we can call :cc command.
> Yes, it is de facto quickfix list, but, I should say, probably, rather
> useless kind of quickfix list.
> Or am i wrong?

the problem is that Vim needs a line number in the quickfix window for
this to work and Christian's expression did not provide one.

With the default value for the 'errorformat' option the following works
for me:

  :cexpr map(split(glob('**/*.xml'), '\n'), 'v:val . ":1: "')

This searches for XML files in all subdirectories which glob() returns
as a single string. The file names are separated by line-feeds, so split
is used to convert this string into a list with each item being a file
name. Then a string consisting of a colon, a dummy line number of 1, a
second colon and a space is appended to every file name. With the default
value for 'errorformat' this can be parsed as a file name, a line number,
and a (nearly empty) text.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us.     (Calvin)

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

Reply via email to