Skip to content

Commit e14c289

Browse files
authored
fix(#1841): do not refresh on buffer events when not a file buffer (#1843)
> Haven't had time to dig into #1841 No worries at all; there's no hurry.
1 parent 4fc74ca commit e14c289

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lua/nvim-tree.lua

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,16 +362,24 @@ local function setup_autocommands(opts)
362362
end
363363

364364
create_nvim_tree_autocmd("BufReadPost", {
365-
callback = function()
366-
if filters.config.filter_no_buffer or renderer.config.highlight_opened_files ~= "none" then
365+
callback = function(data)
366+
-- update opened file buffers
367+
if
368+
(filters.config.filter_no_buffer or renderer.config.highlight_opened_files ~= "none")
369+
and vim.bo[data.buf].buftype == ""
370+
then
367371
reloaders.reload_explorer()
368372
end
369373
end,
370374
})
371375

372376
create_nvim_tree_autocmd("BufUnload", {
373377
callback = function(data)
374-
if filters.config.filter_no_buffer or renderer.config.highlight_opened_files ~= "none" then
378+
-- update opened file buffers
379+
if
380+
(filters.config.filter_no_buffer or renderer.config.highlight_opened_files ~= "none")
381+
and vim.bo[data.buf].buftype == ""
382+
then
375383
reloaders.reload_explorer(nil, data.buf)
376384
end
377385
end,

0 commit comments

Comments
 (0)