Replies: 2 comments 3 replies
-
RE: Honestly, I don't think lazy loading the tree is viable: there will be "race conditions" around events and their ordering. If you are not lazy loading, you can use the API e.g. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I somehow get it works by replacing local fn = vim.fn
local autocmd = vim.api.nvim_create_autocmd
autocmd("VimEnter", {
callback = function()
if fn.argc() == 1 and fn.isdirectory(fn.argv()[1]) ~= 0 then
vim.cmd.NvimTreeOpen(fn.argv()[1])
return true
end
end,
})
autocmd("BufEnter", {
callback = function(data)
if fn.isdirectory(data.file) ~= 0 then
vim.cmd.NvimTreeOpen(data.file)
return true
end
end,
}) |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I lazy-load
nvim-tree
with followingI want load it when enter a directory, ex.
nvim ~/
The above works for me.
I also want load it when edit a directory, ex.
:e ~/
It works when entering vim with argument (ex.
nvim some_file
), then:e ~/
.nvim-tree
open as expected.But when entering vim without any argument (ex.
nvim
), so only one buffer ([No Name]
) . Then:e ~/
,nvim-tree
doesn't open.Beta Was this translation helpful? Give feedback.
All reactions