feat(api): add api.config.mappings.default_on_attach (#2037)

This commit is contained in:
Alexander Courtis
2023-03-06 10:45:58 +11:00
committed by GitHub
parent 1b453441f4
commit bbb6d48910
5 changed files with 90 additions and 72 deletions

View File

@@ -1,14 +1,14 @@
local api = require "nvim-tree.api"
local M = {}
-- stylua: ignore start
function M.default_on_attach(bufnr)
-- BEGIN_DEFAULT_ON_ATTACH
local opts = function(desc)
local api = require('nvim-tree.api')
local function opts(desc)
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
-- BEGIN_DEFAULT_ON_ATTACH
vim.keymap.set('n', '<C-]>', api.tree.change_root_to_node, opts('CD'))
vim.keymap.set('n', '<C-e>', api.node.open.replace_tree_buffer, opts('Open: In Place'))
vim.keymap.set('n', '<C-k>', api.node.show_info_popup, opts('Info'))