This repository has been archived on 2024-05-02. You can view files and clone it, but cannot push or open issues or pull requests.
neovim-flake/neovim-ide/plugin/neo-tree.lua

103 lines
3.4 KiB
Lua

local neotree = require("neo-tree")
local dap = require("dap")
dap.listeners.before.attach.dapui_config = function()
require("neo-tree.command").execute { action = "close" }
end
dap.listeners.before.launch.dapui_config = function()
require("neo-tree.command").execute { action = "close" }
end
neotree.setup {
enable_git_status = true,
enable_diagnostics = true,
source_selector = {
winbar = true,
statusline = false,
sources = {
{ source = "filesystem", display_name = " 󰉓 Files" },
{ source = "git_status", display_name = " 󰊢 Git" },
},
},
filesystem = {
hijack_netrw_behavior = "open_default",
use_libuv_file_watcher = true,
follow_current_file = {
enabled = true,
},
},
default_component_configs = {
icon = {
folder_closed = "",
folder_open = "",
folder_empty = "",
folder_empty_open = "",
},
git_status = {
symbols = {
-- Change type
added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name
modified = "", -- or "", but this is redundant info if you use git_status_colors on the name
deleted = "", -- this can only be used in the git_status source
-- Status type
untracked = "",
ignored = "",
staged = "",
conflict = "",
renamed = "󰁕",
unstaged = "󰄱",
},
},
diagnostics = {
symbols = {
hint = "󰌵",
info = "",
warn = "",
error = "",
},
highlights = {
hint = "DiagnosticSignHint",
info = "DiagnosticSignInfo",
warn = "DiagnosticSignWarn",
error = "DiagnosticSignError",
},
},
},
document_symbols = {
kinds = {
File = { icon = "󰈙", hl = "Tag" },
Namespace = { icon = "󰌗", hl = "Include" },
Package = { icon = "󰏖", hl = "Label" },
Class = { icon = "󰌗", hl = "Include" },
Property = { icon = "󰆧", hl = "@property" },
Enum = { icon = "󰒻", hl = "@number" },
Function = { icon = "󰊕", hl = "Function" },
String = { icon = "󰀬", hl = "String" },
Number = { icon = "󰎠", hl = "Number" },
Array = { icon = "󰅪", hl = "Type" },
Object = { icon = "󰅩", hl = "Type" },
Key = { icon = "󰌋", hl = "" },
Struct = { icon = "󰌗", hl = "Type" },
Operator = { icon = "󰆕", hl = "Operator" },
TypeParameter = { icon = "󰊄", hl = "Type" },
StaticMethod = { icon = "󰠄 ", hl = "Function" },
},
},
hover = {
enabled = true,
delay = 200,
},
event_handlers = {
{
event = "file_opened",
handler = function(_)
require("neo-tree.command").execute { action = "close" }
end,
},
},
}
vim.keymap.set("n", "<leader>e", function()
vim.cmd.Neotree("toggle")
end, { desc = "Toggle File explorer" })