fix(explorer): always use --follow to make sure we see dir symlinks as dirs. Fixes #814

This commit is contained in:
Folke Lemaitre 2025-01-31 13:32:03 +01:00
parent 0e4ddfd3ee
commit 151fd3d62d
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 10 additions and 3 deletions

View file

@ -32,11 +32,11 @@ function M.setup(event)
local function handle(ev)
if ev.file ~= "" and vim.fn.isdirectory(ev.file) == 1 then
local picker = M.open({ cwd = ev.file })
local ref = picker:ref()
if vim.v.vim_did_enter == 0 then
if picker and vim.v.vim_did_enter == 0 then
-- clear bufname so we don't try loading this one again
vim.api.nvim_buf_set_name(ev.buf, "")
picker:show()
local ref = picker:ref()
-- focus on UIEnter, since focusing before doesn't work
vim.api.nvim_create_autocmd("UIEnter", {
once = true,

View file

@ -184,7 +184,14 @@ function State:setup(opts, ctx)
opts = Snacks.picker.util.shallow_copy(opts)
opts.cmd = "fd"
opts.cwd = self.cwd
opts.args = { "--type", "d", "--path-separator", "/", "--absolute-path" }
opts.args = {
"--type",
"d", -- include directories
"--path-separator", -- same everywhere
"/",
"--absolute-path", -- easier to work with
"--follow", -- always needed to make sure we see symlinked dirs as dirs
}
self.all = #ctx.filter.search > 0
if self.all then
local picker = self.picker()