Skip to content

Commit 187388b

Browse files
fix(#1632): autocenter: avoid use of feedkeys (#1632)
1 parent 6ff828b commit 187388b

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
@@ -391,9 +391,11 @@ local function setup_autocommands(opts)
391391
create_nvim_tree_autocmd("BufEnter", {
392392
pattern = "NvimTree_*",
393393
callback = function()
394+
local bufnr = api.nvim_get_current_buf()
394395
vim.schedule(function()
395-
local keys = api.nvim_replace_termcodes("zz", true, false, true)
396-
api.nvim_feedkeys(keys, "n", true)
396+
api.nvim_buf_call(bufnr, function()
397+
vim.cmd [[norm! zz]]
398+
end)
397399
end)
398400
end,
399401
})

0 commit comments

Comments
 (0)