Right-hand side |{rhs}| of the mapping,
can be a Lua function.
• {opts} (`table?`) Table of |:map-arguments|. Same as
|nvim_set_keymap()| {opts}, except:
• {replace_keycodes} defaults to `true` if "expr" is `true`.
Also accepts:
• {buffer}? (`integer|boolean`) Creates buffer-local mapping,
`0` or `true` for current buffer.
• {remap}? (`boolean`, default: `false`) Make the mapping
recursive. Inverse of {noremap}.
See also: ~
• |nvim_set_keymap()|
• |maparg()|
• |mapcheck()|
• |mapset()|
==============================================================================
Lua module: vim.fs *vim.fs*
*vim.fs.exists()*
Use |uv.fs_stat()| to check a file's type, and whether it exists.
Example: >lua
if vim.uv.fs_stat(file) then
vim.print('file exists')
end
<
vim.fs.abspath({path}) *vim.fs.abspath()*
Convert path to an absolute path. A tilde (~) character at the beginning
of the path is expanded to the user's home directory. Does not check if
the path exists, normalize the path, resolve symlinks or hardlinks
(including `.` and `..`), or expand environment variables. If the path is
already absolute, it is returned unchanged. Also converts `\` path
separators to `/`.
Parameters: ~
• {path} (`string`) Path
Return: ~
(`string`) Absolute path
vim.fs.basename({file}) *vim.fs.basename()*
Return the basename of the given path
Attributes: ~
Since: 0.8.0
Parameters: ~
• {file} (`string?`) Path
Return: ~
(`string?`) Basename of {file}
vim.fs.dir({path}, {opts}) *vim.fs.dir()*
Return an iterator over the items located in {path}
Attributes: ~
Since: 0.8.0
Parameters: ~
• {path} (`string`) An absolute or relative path to the directory to
iterate over. The path is first normalized
|vim.fs.normalize()|.
• {opts} (`table?`) Optional keyword arguments:
• depth: integer|nil How deep the traverse (default 1)
• skip: (fun(dir_name: string): boolean)|nil Predicate to
control traversal. Return false to stop searching the
current directory. Only useful when depth > 1
• follow: boolean|nil Follow symbolic links. (default: false)
Return: ~
(`Iterator`) over items in {path}. Each iteration yields two values:
"name" and "type". "name" is the basename of the item relative to
{path}. "type" is one of the following: "file", "directory", "link",
"fifo", "socket", "char", "block", "unknown".
vim.fs.dirname({file}) *vim.fs.dirname()*
Gets the parent directory of the given path (not expanded/resolved, the
caller must do that).
Attributes: ~
Since: 0.8.0
Parameters: ~
• {file} (`string?`) Path
Return: ~
(`string?`) Parent directory of {file}
vim.fs.find({names}, {opts}) *vim.fs.find()*
Find files or directories (or other items as specified by `opts.type`) in
the given path.
Finds items 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. You can set {type}
to "file", "directory", "link", "socket", "char",