fix(dir): reload listing on :edit #40496

This commit is contained in:
Barrett Ruth
2026-06-30 13:19:53 -05:00
committed by GitHub
parent d303617132
commit 784ab9edfb
2 changed files with 24 additions and 2 deletions

View File

@@ -195,6 +195,16 @@ function first_open(buf, dir)
return
end
vim.b[buf].nvim_dir = dir
api.nvim_create_autocmd('BufReadCmd', {
buffer = buf,
nested = true,
desc = 'Reload directory listing',
callback = function()
if vim.b[buf].nvim_dir ~= nil then
reload(buf)
end
end,
})
set_maps(buf)
if api.nvim_get_option_value('filetype', { buf = buf }) ~= 'directory' then
api.nvim_set_option_value('filetype', 'directory', { buf = buf })