diff options
| author | historia <[not public]> | 2026-06-15 21:28:28 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-15 21:28:28 -0400 |
| commit | 920942239d2506cd48fde575da65b16742f6f575 (patch) | |
| tree | 395f7f8291d847fc16723f55aab81d387ce969d6 /lua | |
| parent | fb651914cdc7111e3c5f6add5d209dc31d21c079 (diff) | |
| download | denote-fzf-lua-920942239d2506cd48fde575da65b16742f6f575.tar.gz | |
fix: vim.fn.readdir changed to vim.loop_fs_scandir
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/denote-fzf-lua.lua | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/lua/denote-fzf-lua.lua b/lua/denote-fzf-lua.lua index 508730e..c2999bb 100644 --- a/lua/denote-fzf-lua.lua +++ b/lua/denote-fzf-lua.lua @@ -12,17 +12,16 @@ local function list_denote_files(dir) while #stack > 0 do local current = table.remove(stack) - local ok, entries = pcall(vim.fn.readdir, current) - if ok then - for _, entry in ipairs(entries) do - local full = current .. "/" .. entry - local stat = vim.loop.fs_stat(full) - if stat then - if stat.type == "directory" then - table.insert(stack, full) - elseif stat.type == "file" and entry:match("^%d%d%d%d%d%d%d%dT%d%d%d%d%d%d") then - table.insert(results, full) - end + local ok, handle = pcall(vim.loop.fs_scandir, current) + if ok and handle then + while true do + local name, typ = vim.loop.fs_scandir_next(handle) + if not name then break end + local full = current .. "/" .. name + if typ == "directory" then + table.insert(stack, full) + elseif (typ == "file" or typ == "link") and name:match("^%d%d%d%d%d%d%d%dT%d%d%d%d%d%d") then + table.insert(results, full) end end end @@ -168,6 +167,10 @@ end function M.search_files(options) local files = list_denote_files(options.dir) + if #files == 0 then + vim.notify("denote-fzf-lua: no Denote files found in " .. options.dir, vim.log.levels.WARN) + return + end local lines = format_denote_table(files) local opts = {} |
