1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
return {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
lazy = false,
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim",
},
keys = {
{ "<leader>e", "<cmd>Neotree toggle<cr>", desc = "Toggle file explorer" },
},
config = function()
require("neo-tree").setup({
close_if_last_window = true,
filesystem = {
follow_current_file = { enabled = true },
filtered_items = {
visible = true,
hide_dotfiles = false,
hide_gitignored = false,
},
},
})
-- Open neo-tree when no file is specified (mirrors the vimrc's old
-- NERDTree auto-open behavior), but not when nvim is reading stdin.
local augroup = vim.api.nvim_create_augroup("neotree_auto", { clear = true })
vim.api.nvim_create_autocmd("StdinReadPre", {
group = augroup,
callback = function()
vim.g.std_in = 1
end,
})
vim.api.nvim_create_autocmd("VimEnter", {
group = augroup,
callback = function()
if vim.fn.argc() == 0 and vim.g.std_in == nil then
vim.cmd("Neotree show")
end
end,
})
end,
}
|