Expand Contents of external lists into a Variable

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Expand Contents of external lists into a Variable

Alejandro Calbazana
Hello,

Is there any utility script out there that allow me to load the contents
of a directory into a variable.  Something like, "load all of the file
names in directory X into a variable"?

I'd also be interested in any pointers (articles, existing plugins, etc)
on interoperating with external languages (Perl) in order to parse files
and hand back results to Vim.

Thanks!

Alejandro
Reply | Threaded
Open this post in threaded view
|

Re: Expand Contents of external lists into a Variable

Marian Csontos
Hi,

> Is there any utility script out there that allow me to load the contents  
> of a directory into a variable.  Something like, "load all of the file  
> names in directory X into a variable"?

there exists function glob() which returns all matching files (uses  
wildcards, not regular-expression),
and similar function globpath()
see :help glob()

Regards

-- Marian


________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Server.
http://www.nod32.com
Reply | Threaded
Open this post in threaded view
|

Re: Expand Contents of external lists into a Variable

Tim Chase-2
>> Is there any utility script out there that allow me to load the
>> contents  of a directory into a variable.  Something like, "load all
>> of the file  names in directory X into a variable"?
>
>
> there exists function glob() which returns all matching files (uses  
> wildcards, not regular-expression),
> and similar function globpath()
> see :help glob()

You can also use

        :let myvar=expand("*.txt")

I'm not sure what sort of distinction exists between glob() and
expand() other than that expand() has some additional functionality.

-tim