How do I make the explorer opened when I open a file? #2717
|
For example, when I execute I'm using LazyVim, I'll appreciate if you can tell me how to do this in LazyVim. |
Answered by
dpetka2001
Feb 7, 2026
Replies: 1 comment 1 reply
vim.api.nvim_create_autocmd("VimEnter", {
group = vim.api.nvim_create_augroup("open_explorer", {}),
callback = function()
-- Open scoped to the file's root directory
-- Snacks.explorer({ cwd = LazyVim.root(), enter = false })
-- Open scoped to the pwd
local picker = Snacks.explorer.reveal({ buf = 0 })
picker.opts.hidden = true
picker.opts.enter = false
end,
}) |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This won't focus the buffer. Should be
Snacks.explorer({ cwd = LazyVim.root(), enter = false }). Or changeopts.hidden = truetoopts.enter = false. Also no need to definebuf = 0, since this will be default.Personally I'd go with the commented line to also keep consistent behavior with default LazyVim.