65 lines
1.6 KiB
Lua
65 lines
1.6 KiB
Lua
return {
|
|
"nvim-neo-tree/neo-tree.nvim",
|
|
branch = "v3.x",
|
|
dependencies = {
|
|
"nvim-lua/plenary.nvim",
|
|
"nvim-tree/nvim-web-devicons",
|
|
"MunifTanjim/nui.nvim",
|
|
},
|
|
cmd = "Neotree",
|
|
keys = {
|
|
{
|
|
"<leader>n",
|
|
function() require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() }) end,
|
|
desc = "Explorer NeoTree",
|
|
},
|
|
{
|
|
"<leader>ge",
|
|
function() require("nvim-tree.command").exceute({ source = "git_status", toggle = true }) end,
|
|
desc = "Git Explorer",
|
|
},
|
|
},
|
|
init = function()
|
|
vim.api.nvim_create_autocmd("BufEnter", {
|
|
group = vim.api.nvim_create_augroup("Neotree_start_directory", { clear = true }),
|
|
desc = "Start Neo-Tree with directory",
|
|
once = true,
|
|
callback = function()
|
|
if package.loaded["neo-tree"] then
|
|
return
|
|
else
|
|
local stats = vim.uv.fs_stat(vim.fn.argv(0))
|
|
if stats and stats.type == "directory" then require("neo-tree") end
|
|
end
|
|
end,
|
|
})
|
|
end,
|
|
---@module "neo-tree"
|
|
---@type neotree.Config?
|
|
opts = {
|
|
sources = { "filesystem", "buffers", "git_status" },
|
|
open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" },
|
|
filesystem = {
|
|
bind_to_cwd = false,
|
|
follow_current_file = { enabled = true },
|
|
use_libuv_file_watcher = true,
|
|
},
|
|
window = {
|
|
mappings = {
|
|
["l"] = "open",
|
|
["h"] = "close_node",
|
|
["<space>"] = "none",
|
|
["Y"] = {
|
|
function(state)
|
|
local node = state.tree:get_node()
|
|
local path = node:get_id()
|
|
vim.fn.setreg("+", path, "c")
|
|
end,
|
|
desc = "Copy Path to Clipboard",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
config = function(_, opts) require("neo-tree").setup(opts) end,
|
|
}
|