Skip to content

Commit 7cbd608

Browse files
committed
fix: use event bufnr
1 parent bd47644 commit 7cbd608

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lua/nvim-tree.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,9 @@ local function setup_autocommands(opts)
406406
if opts.view.centralize_selection then
407407
create_nvim_tree_autocmd("BufEnter", {
408408
pattern = "NvimTree_*",
409-
callback = function()
409+
callback = function(event)
410410
vim.schedule(function()
411-
local bufnr = vim.api.nvim_get_current_buf()
412-
vim.api.nvim_buf_call(bufnr, function()
411+
vim.api.nvim_buf_call(event.buf, function()
413412
vim.cmd [[norm! zz]]
414413
end)
415414
end)

0 commit comments

Comments
 (0)