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.
This commit is contained in:
Alexander Courtis 2022-12-19 17:18:27 +11:00 committed by GitHub
parent 4fc74ca321
commit e14c2895b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -362,8 +362,12 @@ local function setup_autocommands(opts)
end
create_nvim_tree_autocmd("BufReadPost", {
callback = function()
if filters.config.filter_no_buffer or renderer.config.highlight_opened_files ~= "none" then
callback = function(data)
-- update opened file buffers
if
(filters.config.filter_no_buffer or renderer.config.highlight_opened_files ~= "none")
and vim.bo[data.buf].buftype == ""
then
reloaders.reload_explorer()
end
end,
@ -371,7 +375,11 @@ local function setup_autocommands(opts)
create_nvim_tree_autocmd("BufUnload", {
callback = function(data)
if filters.config.filter_no_buffer or renderer.config.highlight_opened_files ~= "none" then
-- update opened file buffers
if
(filters.config.filter_no_buffer or renderer.config.highlight_opened_files ~= "none")
and vim.bo[data.buf].buftype == ""
then
reloaders.reload_explorer(nil, data.buf)
end
end,