nvim-config/lua/plugins/neotree.lua
2025-02-27 11:49:14 -05:00

41 lines
1.1 KiB
Lua

return {
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
},
keys = {
{
"<leader>e",
function()
require("neo-tree.command").execute({ toggle = true, dir = vim.loop.cwd() })
end,
desc = "Open file explorer",
},
},
opts = {
open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", }, -- From LazyVim
close_if_last_window = true,
window = {
width = 30,
mappings = {
["<space>"] = "none",
},
},
},
init = function()
-- Load instead of netrw
if vim.fn.argc(-1) == 1 then
local stat = vim.loop.fs_stat(vim.fn.argv(0))
if stat and stat.type == "directory" then
require("neo-tree")
end
end
end,
},
}