-
Hi, first let me thank you for this project. I'm new to Neovim and having a file browser makes things much easier. I have two questions:
I always have to type :Neotree to open it, everytime I start nvim.
Maybe getting the first question answered will solve this but what I do is, I often open my files with :tabedit since I don't like having split screens to work with. Hope it's possible as this would make things simpler here. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I think both are achievable with autocmds.
First of all, if you launch (a barebone) nvim with a dot Neo-tree has a fuctionality of hijacking this behavior to make neo-tree appear instead of netrw which can be configured with If you want to go even further, and make neo-tree appear when just running vim.api.nvim_create_autocmd("VimEnter", {
pattern = "*",
group = vim.api.nvim_create_augroup("NeotreeOnOpen", { clear = true }),
once = true,
callback = function(_)
if vim.fn.argc() == 0 then
vim.cmd("Neotree")
end
end,
})
There is an autocmd called when a new tab is created. You can simply automate vim.api.nvim_create_autocmd("TabNew", {
group = vim.api.nvim_create_augroup("NeotreeOnNewTab", { clear = true }),
command = "Neotree",
}) |
Beta Was this translation helpful? Give feedback.
I think both are achievable with autocmds.
First of all, if you launch (a barebone) nvim with a dot
nvim .
at any directory, nvim will openNetrw
, a built-in file manager, to give a glance on the folder structures.Neo-tree has a fuctionality of hijacking this behavior to make neo-tree appear instead of netrw which can be configured with
config.filesystem.hijack_netrw_behavior =
Options see here.If you want to go even further, and make neo-tree appear when just running
nvim
, BUT NOT whennvim random-file-name.txt
, you can add the following autocmd to somewhere in your config. FYI,vim.fn.argc()
counts the number of command line argum…