2024-06-22 02:52:21 +00:00
|
|
|
vim.g.loaded_netrw = 1
|
|
|
|
vim.g.loaded_netrwPlugin = 1
|
|
|
|
|
|
|
|
local function on_attach(bufnr)
|
|
|
|
local api = require("nvim-tree.api")
|
|
|
|
|
|
|
|
local function opts(desc)
|
|
|
|
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
|
|
|
end
|
|
|
|
|
|
|
|
local function edit_or_open()
|
|
|
|
local node = api.tree.get_node_under_cursor()
|
|
|
|
|
|
|
|
if node.nodes ~= nil then
|
|
|
|
-- expand or collapse folder
|
|
|
|
api.node.open.edit()
|
|
|
|
else
|
|
|
|
-- open file
|
|
|
|
api.node.open.edit()
|
|
|
|
-- Close the tree if file was opened
|
|
|
|
api.tree.close()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
api.config.mappings.default_on_attach(bufnr)
|
|
|
|
vim.keymap.set("n", "<CR>", edit_or_open, opts("Open"))
|
|
|
|
end
|
|
|
|
|
|
|
|
require("nvim-tree").setup({
|
2024-10-18 04:04:03 +00:00
|
|
|
sort_by = "case_sensitive",
|
|
|
|
view = {
|
2024-06-22 02:52:21 +00:00
|
|
|
adaptive_size = false,
|
2024-10-18 04:04:03 +00:00
|
|
|
centralize_selection = true,
|
|
|
|
width = 30,
|
|
|
|
side = "left",
|
|
|
|
preserve_window_proportions = false,
|
|
|
|
number = false,
|
|
|
|
relativenumber = false,
|
|
|
|
signcolumn = "yes",
|
|
|
|
float = {
|
2024-06-22 02:52:21 +00:00
|
|
|
enable = false,
|
|
|
|
quit_on_focus_loss = true,
|
|
|
|
open_win_config = {
|
|
|
|
relative = "editor",
|
|
|
|
border = "rounded",
|
|
|
|
width = 30,
|
|
|
|
height = 30,
|
|
|
|
row = 1,
|
|
|
|
col = 1,
|
|
|
|
},
|
2024-10-18 04:04:03 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
renderer = {
|
|
|
|
group_empty = true,
|
|
|
|
},
|
2024-06-22 02:52:21 +00:00
|
|
|
actions = {
|
|
|
|
use_system_clipboard = true,
|
|
|
|
change_dir = {
|
|
|
|
enable = true,
|
2024-10-18 04:04:03 +00:00
|
|
|
global = false,
|
2024-06-22 02:52:21 +00:00
|
|
|
restrict_above_cwd = false,
|
2024-10-18 04:04:03 +00:00
|
|
|
},
|
|
|
|
expand_all = {
|
2024-06-22 02:52:21 +00:00
|
|
|
max_folder_discovery = 300,
|
|
|
|
exclude = {},
|
2024-10-18 04:04:03 +00:00
|
|
|
},
|
|
|
|
file_popup = {
|
2024-06-22 02:52:21 +00:00
|
|
|
open_win_config = {
|
|
|
|
col = 1,
|
|
|
|
row = 1,
|
|
|
|
relative = "cursor",
|
|
|
|
border = "shadow",
|
|
|
|
style = "minimal",
|
|
|
|
},
|
2024-10-18 04:04:03 +00:00
|
|
|
},
|
2024-06-22 02:52:21 +00:00
|
|
|
open_file = {
|
|
|
|
window_picker = {
|
|
|
|
enable = false,
|
|
|
|
picker = "default",
|
|
|
|
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
|
|
|
|
exclude = {
|
|
|
|
filetype = { "notify", "lazy", "qf", "diff", "fugitive", "fugitiveblame" },
|
|
|
|
buftype = { "nofile", "terminal", "help" },
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
remove_file = {
|
|
|
|
close_window = true,
|
2024-10-18 04:04:03 +00:00
|
|
|
},
|
2024-06-22 02:52:21 +00:00
|
|
|
|
|
|
|
},
|
|
|
|
tab = {
|
2024-10-18 04:04:03 +00:00
|
|
|
sync = {
|
2024-06-22 02:52:21 +00:00
|
|
|
open = false,
|
|
|
|
close = false,
|
|
|
|
ignore = {},
|
2024-10-18 04:04:03 +00:00
|
|
|
},
|
|
|
|
},
|
2024-06-22 02:52:21 +00:00
|
|
|
git = {
|
2024-10-18 04:04:03 +00:00
|
|
|
enable = true,
|
|
|
|
ignore = false,
|
|
|
|
show_on_dirs = true,
|
|
|
|
show_on_open_dirs = true,
|
|
|
|
timeout = 200,
|
|
|
|
},
|
2024-06-22 02:52:21 +00:00
|
|
|
filters = {
|
2024-10-18 04:04:03 +00:00
|
|
|
dotfiles = false,
|
|
|
|
git_clean = false,
|
|
|
|
no_buffer = false,
|
|
|
|
custom = { "node_modules", "\\.cache" },
|
|
|
|
exclude = {},
|
|
|
|
},
|
2024-06-22 02:52:21 +00:00
|
|
|
update_cwd = true,
|
|
|
|
respect_buf_cwd = true,
|
|
|
|
update_focused_file = {
|
|
|
|
enable = true,
|
|
|
|
update_cwd = true
|
|
|
|
},
|
|
|
|
on_attach = on_attach
|
|
|
|
})
|