nix/modules/home/programs/neovim/plugins/nvim-tree.lua

21 lines
673 B
Lua
Raw Normal View History

2024-03-09 17:18:36 +01:00
local function my_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
-- default mappings
api.config.mappings.default_on_attach(bufnr)
-- custom mappings
vim.keymap.set('n', '<C-t>', api.tree.change_root_to_parent, opts('Up'))
vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help'))
vim.keymap.set('n', '.', api.tree.change_root_to_node, opts('CD'))
end
-- pass to setup along with your other options
require("nvim-tree").setup {
on_attach = my_on_attach,
}