Opening nvim-tree without stealing focus on nvim start #2804
-
Hey, I am trying to get nvim-tree to open on start without stealing focus. I have the following function: vim.api.nvim_create_autocmd({ "BufReadPost" }, {
callback = function()
if not api.tree.is_visible() then
api.tree.toggle({
focus = false,
})
end
end,
}) It steals the focus on opening the tree. However, running the following command manually works:
Does anyone have an idea what could be the issue or have a solution/alternative? That would be greatly appreciated! nvim-tree version: 2086e56 Lazy Config
"nvim-tree/nvim-tree.lua",
dependencies = {
"nvim-tree/nvim-web-devicons", -- optional, for file icons
},
init = function()
require("nvim-tree-config")
end,
opts = {
renderer = {
highlight_modified = "name",
},
modified = {
enable = true,
},
diagnostics = {
enable = true,
},
update_focused_file = { enable = true },
filters = {
dotfiles = false,
git_ignored = false,
},
},
}, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Sorry, lazy's startup ordering is only somewhat deterministic: wiki: Lazy Loading I suggest you take a look at wiki: Open At Startup for robust solutions. |
Beta Was this translation helpful? Give feedback.
Sorry, lazy's startup ordering is only somewhat deterministic: wiki: Lazy Loading
I suggest you take a look at wiki: Open At Startup for robust solutions.