74 lines
1.7 KiB
Lua
Raw Normal View History

2024-01-22 14:04:33 +00:00
local function on_attach(bufnr)
local api = require("nvim-tree.api")
-- default mappings
api.config.mappings.default_on_attach(bufnr)
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
-- navigation
vim.keymap.set("n", "<C-Up>", api.tree.change_root_to_parent, opts("Up"))
2024-02-01 22:59:16 +00:00
vim.keymap.set("n", "<C-Left>", api.tree.change_root_to_parent, opts("Up"))
vim.keymap.set("n", "<C-Down>", api.tree.change_root_to_node, opts("Enter"))
vim.keymap.set("n", "<C-Right>", api.tree.change_root_to_node, opts("Enter"))
2024-01-22 14:04:33 +00:00
-- open folders with a single click
vim.keymap.set("n", "<LeftRelease>", function()
vim.defer_fn(function ()
local win = vim.api.nvim_get_current_win()
local view = require("nvim-tree.view")
if view.get_winnr() ~= win then return end
api.node.open.edit()
api.tree.focus()
end, 10)
end, opts("Open folder/file"))
end
2023-08-19 17:22:56 +00:00
return {
"nvim-tree/nvim-tree.lua",
event = "VeryLazy",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
2023-08-22 14:51:35 +00:00
keys = {
{ "<leader>e", function() require("nvim-tree.api").tree.toggle() end, desc = "Toggle files" },
},
2023-08-21 17:19:37 +00:00
opts = {
filesystem_watchers = {
enable = true,
},
filters = {
dotfiles = false,
},
2024-01-22 14:04:33 +00:00
on_attach = on_attach,
2023-08-21 17:19:37 +00:00
renderer = {
2023-08-29 11:29:37 +00:00
root_folder_label = false,
highlight_git = true,
icons = {
show = {
git = false,
},
glyphs = {
git = {
unstaged = "",
untracked = "",
deleted = "",
},
},
},
2023-08-21 17:19:37 +00:00
},
sync_root_with_cwd = true,
update_focused_file = {
enable = true,
update_root = false,
},
view = {
2024-03-01 23:32:40 +00:00
width = 30,
2023-08-21 17:19:37 +00:00
},
},
2023-10-20 13:55:21 +00:00
config = true,
2023-08-19 17:22:56 +00:00
}