aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/fs.lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim/fs.lua')
-rw-r--r--runtime/lua/vim/fs.lua12
1 files changed, 4 insertions, 8 deletions
diff --git a/runtime/lua/vim/fs.lua b/runtime/lua/vim/fs.lua
index 8b4242223a..8862afc760 100644
--- a/runtime/lua/vim/fs.lua
+++ b/runtime/lua/vim/fs.lua
@@ -136,7 +136,7 @@ end
--- - 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: true)
+--- - 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}.
@@ -179,7 +179,7 @@ function M.dir(path, opts)
if
opts.depth
and level < opts.depth
- and (t == 'directory' or (t == 'link' and opts.follow ~= false and (vim.uv.fs_stat(
+ and (t == 'directory' or (t == 'link' and opts.follow and (vim.uv.fs_stat(
M.joinpath(path, f)
) or {}).type == 'directory'))
and (not opts.skip or opts.skip(f) ~= false)
@@ -217,7 +217,7 @@ end
--- @field limit? number
---
--- Follow symbolic links.
---- (default: `true`)
+--- (default: `false`)
--- @field follow? boolean
--- Find files or directories (or other items as specified by `opts.type`) in the given path.
@@ -357,11 +357,7 @@ function M.find(names, opts)
if
type_ == 'directory'
- or (
- type_ == 'link'
- and opts.follow ~= false
- and (vim.uv.fs_stat(f) or {}).type == 'directory'
- )
+ or (type_ == 'link' and opts.follow and (vim.uv.fs_stat(f) or {}).type == 'directory')
then
dirs[#dirs + 1] = f
end