diff options
author | Gregory Anders <greg@gpanders.com> | 2022-05-15 20:37:35 -0600 |
---|---|---|
committer | Gregory Anders <greg@gpanders.com> | 2022-05-31 13:04:41 -0600 |
commit | f271d706611049bc53a6a439b310fe60bf0fab13 (patch) | |
tree | e02db4304f800e9ee9f3750edda5bf31b64e1f51 /runtime/doc | |
parent | 2a62bec37ced51678ff914700d7165605d5a0d53 (diff) | |
download | rneovim-f271d706611049bc53a6a439b310fe60bf0fab13.tar.gz rneovim-f271d706611049bc53a6a439b310fe60bf0fab13.tar.bz2 rneovim-f271d706611049bc53a6a439b310fe60bf0fab13.zip |
feat(fs): add vim.fs.find()
This is a pure Lua implementation of the Vim findfile() and finddir()
functions without the special syntax.
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/lua.txt | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 5274b829b5..ba59c67446 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2183,6 +2183,46 @@ dirname({file}) *vim.fs.dirname()* Return: ~ (string) Parent directory of {file} +find({names}, {opts}) *vim.fs.find()* + Find files or directories in the given path. + + Finds any files or directories given in {names} starting from + {path}. If {upward} is "true" then the search traverses upward + through parent directories; otherwise, the search traverses + downward. Note that downward searches are recursive and may + search through many directories! If {stop} is non-nil, then + the search stops when the directory given in {stop} is + reached. The search terminates when {limit} (default 1) + matches are found. The search can be narrowed to find only + files or or only directories by specifying {type} to be "file" + or "directory", respectively. + + Parameters: ~ + {names} (string|table) Names of the files and directories + to find. Must be base names, paths and globs are + not supported. + {opts} (table) Optional keyword arguments: + • path (string): Path to begin searching from. If + omitted, the current working directory is used. + • upward (boolean, default false): If true, + search upward through parent directories. + Otherwise, search through child directories + (recursively). + • stop (string): Stop searching when this + directory is reached. The directory itself is + not searched. + • type (string): Find only files ("file") or + directories ("directory"). If omitted, both + files and directories that match {name} are + included. + • limit (number, default 1): Stop the search + after finding this many matches. Use + `math.huge` to place no limit on the number of + matches. + + Return: ~ + (table) The paths of all matching files or directories + parents({start}) *vim.fs.parents()* Iterate over all the parents of the given file or directory. |