feat(mapping): deprecate user mappings and add on_attach (#1424)

This commit is contained in:
Kiyan
2022-07-26 11:09:39 +02:00
committed by GitHub
parent 5f30a7bee4
commit 64cc3c17e1
6 changed files with 385 additions and 128 deletions

View File

@@ -92,7 +92,12 @@ local function create_buffer(bufnr)
vim.bo[M.get_bufnr()][option] = value
end
require("nvim-tree.actions").apply_mappings(M.get_bufnr())
if type(M.on_attach) == "function" then
require("nvim-tree.keymap").set_keymaps(M.get_bufnr())
M.on_attach(M.get_bufnr())
else
require("nvim-tree.actions").apply_mappings(M.get_bufnr())
end
end
local function get_size()
@@ -426,6 +431,7 @@ function M.setup(opts)
M.View.winopts.number = options.number
M.View.winopts.relativenumber = options.relativenumber
M.View.winopts.signcolumn = options.signcolumn
M.on_attach = opts.on_attach
end
return M