Skip to content

Commit 80b45c6

Browse files
fix: autocenter: avoid use of feedkeys
1 parent b4d704e commit 80b45c6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lua/nvim-tree.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,11 @@ local function setup_autocommands(opts)
388388
create_nvim_tree_autocmd("BufEnter", {
389389
pattern = "NvimTree_*",
390390
callback = function()
391+
local bufnr = api.nvim_get_current_buf()
391392
vim.schedule(function()
392-
local keys = api.nvim_replace_termcodes("zz", true, false, true)
393-
api.nvim_feedkeys(keys, "n", true)
393+
api.nvim_buf_call(bufnr, function()
394+
vim.cmd [[norm! zz]]
395+
end)
394396
end)
395397
end,
396398
})

0 commit comments

Comments
 (0)