84 lines
2.6 KiB
Lua
84 lines
2.6 KiB
Lua
return {
|
|
{
|
|
"nvim-neo-tree/neo-tree.nvim",
|
|
opts = {
|
|
sources = { "filesystem", "buffers", "git_status" },
|
|
open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" },
|
|
close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab
|
|
popup_border_style = "rounded",
|
|
enable_git_status = true,
|
|
enable_diagnostics = true,
|
|
filesystem = {
|
|
bind_to_cwd = false,
|
|
follow_current_file = { enabled = true },
|
|
use_libuv_file_watcher = true,
|
|
components = {
|
|
name = function(config, node, state)
|
|
local result = require("neo-tree.sources.filesystem.components").name(config, node, state)
|
|
|
|
-- Check if the file is open in a buffer
|
|
local is_open = false
|
|
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
|
|
if vim.api.nvim_buf_get_name(buf) == node.path then
|
|
is_open = true
|
|
break
|
|
end
|
|
end
|
|
|
|
-- Add an indicator if the file is open
|
|
if is_open then
|
|
result.text = result.text .. " "
|
|
end
|
|
|
|
return result
|
|
end,
|
|
},
|
|
},
|
|
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",
|
|
},
|
|
["O"] = {
|
|
function(state)
|
|
require("lazy.util").open(state.tree:get_node().path, { system = true })
|
|
end,
|
|
desc = "Open with System Application",
|
|
},
|
|
["P"] = { "toggle_preview", config = { use_float = false } },
|
|
},
|
|
},
|
|
|
|
default_component_configs = {
|
|
indent = {
|
|
with_expanders = true, -- if nil and file nesting is enabled, will enable expanders
|
|
expander_collapsed = "",
|
|
expander_expanded = "",
|
|
expander_highlight = "NeoTreeExpander",
|
|
},
|
|
git_status = {
|
|
symbols = {
|
|
unstaged = "",
|
|
staged = "",
|
|
},
|
|
},
|
|
}
|
|
},
|
|
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
|
|
}
|
|
}
|
|
}
|
|
|