import { fn } from "https://deno.land/x/ddc_vim@v4.0.2/deps.ts";
const { glob } = fn;
Expand the file wildcards in {expr}. See wildcards
for the
use of special characters.
Unless the optional {nosuf} argument is given and is TRUE
,
the 'suffixes' and 'wildignore' options apply: Names matching
one of the patterns in 'wildignore' will be skipped and
'suffixes' affect the ordering of matches.
'wildignorecase' always applies.
When {list} is present and it is TRUE
the result is a List
with all matching files. The advantage of using a List is,
you also get filenames containing newlines correctly.
Otherwise the result is a String and when there are several
matches, they are separated by <NL>
characters.
If the expansion fails, the result is an empty String or List.
You can also use readdir()
if you need to do complicated
things, such as limiting the number of matches.
A name for a non-existing file is not included. A symbolic
link is only included if it points to an existing file.
However, when the {alllinks} argument is present and it is
TRUE
then all symbolic links are included.
For most systems backticks can be used to get files names from any external command. Example:
:let tagfiles = glob("`find . -name tags -print`")
:let &tags = substitute(tagfiles, "\n", ",", "g")
The result of the program inside the backticks should be one item per line. Spaces inside an item are allowed.
See expand()
for expanding special Vim variables. See
system()
for getting the raw output of an external command.
Can also be used as a method
:
GetExpr()->glob()