You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
152 lines
4.9 KiB
152 lines
4.9 KiB
local get_icon = require("astroui").get_icon
|
|
|
|
return {
|
|
"nvim-neo-tree/neo-tree.nvim",
|
|
dependencies = { "MunifTanjim/nui.nvim" },
|
|
cmd = "Neotree",
|
|
opts = {
|
|
auto_clean_after_session_restore = true,
|
|
close_if_last_window = false,
|
|
source_selector = {
|
|
winbar = false,
|
|
content_layout = "center",
|
|
},
|
|
default_component_configs = {
|
|
indent = {
|
|
indent_size = 2,
|
|
padding = 1, -- extra padding on left hand side
|
|
with_markers = true,
|
|
indent_marker = "│",
|
|
last_indent_marker = "└",
|
|
highlight = "NeoTreeIndentMarker",
|
|
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders
|
|
expander_collapsed = "",
|
|
expander_expanded = "",
|
|
expander_highlight = "NeoTreeExpander",
|
|
},
|
|
modified = { symbol = get_icon "FileModified" },
|
|
name = {
|
|
trailing_slash = false,
|
|
use_git_status_colors = true,
|
|
highlight = "NeoTreeFileName",
|
|
},
|
|
git_status = {
|
|
symbols = {
|
|
added = get_icon "GitAdd",
|
|
deleted = get_icon "GitDelete",
|
|
modified = get_icon "GitChange",
|
|
renamed = get_icon "GitRenamed",
|
|
untracked = "",
|
|
ignored = get_icon "GitIgnored",
|
|
unstaged = get_icon "GitUnstaged",
|
|
staged = get_icon "GitStaged",
|
|
conflict = get_icon "GitConflict",
|
|
},
|
|
},
|
|
},
|
|
window = {
|
|
width = 35,
|
|
mappings = {
|
|
["<space>"] = false, -- disable space until we figure out which-key disabling
|
|
["[b"] = "prev_source",
|
|
["]b"] = "next_source",
|
|
o = "open",
|
|
O = "system_open",
|
|
h = "parent_or_close",
|
|
l = "child_or_open",
|
|
Y = "copy_selector",
|
|
},
|
|
},
|
|
filesystem = {
|
|
filtered_items = {
|
|
visible = true, -- when true, they will just be displayed differently than normal items
|
|
hide_dotfiles = false,
|
|
hide_gitignored = false,
|
|
hide_hidden = false, -- only works on Windows for hidden files/directories
|
|
hide_by_name = {
|
|
--"node_modules"
|
|
},
|
|
hide_by_pattern = { -- uses glob style patterns
|
|
--"*.meta",
|
|
--"*/src/*/tsconfig.json",
|
|
"*_templ.go",
|
|
},
|
|
always_show = { -- remains visible even if other settings would normally hide it
|
|
--".gitignored",
|
|
},
|
|
never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show
|
|
--".DS_Store",
|
|
--"thumbs.db"
|
|
},
|
|
never_show_by_pattern = { -- uses glob style patterns
|
|
--".null-ls_*",
|
|
},
|
|
},
|
|
follow_current_file = {
|
|
enabled = true,
|
|
},
|
|
hijack_netrw_behavior = "open_current",
|
|
use_libuv_file_watcher = true,
|
|
commands = {
|
|
delete = function(state)
|
|
local tree = state.tree
|
|
local node = tree:get_node()
|
|
local log = require "neo-tree.log"
|
|
local inputs = require "neo-tree.ui.inputs"
|
|
|
|
local msg = string.format("Are you sure you want to delete '%s'?", node.name)
|
|
local do_delete_ = function(confirmed)
|
|
if not confirmed then return end
|
|
vim.fn.system { "gio", "trash", node.path }
|
|
end
|
|
|
|
if node.type == "file" or node.type == "directory" then
|
|
inputs.confirm(msg, do_delete_)
|
|
else
|
|
log.warn "The `delete` command can only be used on files and directories"
|
|
end
|
|
end,
|
|
delete_visual = function(state, selected_nodes)
|
|
local paths_to_delete = {}
|
|
local inputs = require "neo-tree.ui.inputs"
|
|
|
|
for _, node_to_delete in pairs(selected_nodes) do
|
|
if node_to_delete.type == "file" or node_to_delete.type == "directory" then
|
|
table.insert(paths_to_delete, node_to_delete.path)
|
|
end
|
|
end
|
|
|
|
local msg = "Are you sure you want to delete " .. #paths_to_delete .. " items?"
|
|
local do_delete_ = function(confirmed)
|
|
if not confirmed then return end
|
|
for _, path in pairs(paths_to_delete) do
|
|
vim.fn.system { "gio", "trash", path }
|
|
end
|
|
end
|
|
inputs.confirm(msg, do_delete_)
|
|
end,
|
|
},
|
|
},
|
|
buffers = {
|
|
follow_current_file = {
|
|
enabled = true,
|
|
}, -- This will find and focus the file in the active buffer every
|
|
-- time the current file is changed while the tree is open.
|
|
group_empty_dirs = true, -- when true, empty folders will be grouped together
|
|
show_unloaded = true,
|
|
window = {
|
|
mappings = {
|
|
["bd"] = "buffer_delete",
|
|
["<bs>"] = "navigate_up",
|
|
["."] = "set_root",
|
|
},
|
|
},
|
|
},
|
|
event_handlers = {
|
|
{
|
|
event = "neo_tree_buffer_enter",
|
|
handler = function(_) vim.opt_local.signcolumn = "auto" end,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|