Skip to main content
Module

x/denops_std/function/mod.ts>globpath

📚 Standard module for denops.vim
Go to Latest
function globpath
import { globpath } from "https://deno.land/x/denops_std@v6.4.0/function/mod.ts";

Perform glob() for String {expr} on all directories in {path} and concatenate the results. Example:

:echo globpath(&rtp, "syntax/c.vim")

{path} is a comma-separated list of directory names. Each directory name is prepended to {expr} and expanded like with glob(). A path separator is inserted when needed. To add a comma inside a directory name escape it with a backslash. Note that on MS-Windows a directory may have a trailing backslash, remove it if you put a comma after it. If the expansion fails for one of the directories, there is no error message.

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.

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. Example:

:echo globpath(&rtp, "syntax/c.vim", 0, 1)

{alllinks} is used as with glob().

The "**" item can be used to search in a directory tree. For example, to find all "README.txt" files in the directories in 'runtimepath' and below:

:echo globpath(&rtp, "** /README.txt")

Upwards search and limiting the depth of "**" is not supported, thus using 'path' will not always work properly.

Can also be used as a method, the base is passed as the second argument:

GetExpr()->globpath(&rtp)

Parameters

denops: Denops
path: unknown
expr: unknown
optional
nosuf: unknown
optional
list: unknown

Returns

Promise<string>