1
0

Add escape keymap to close nvim-tree

This commit is contained in:
Patrick Auernig 2023-08-25 15:38:17 +02:00
parent 1b1087ef55
commit 89a5ae5140

View File

@ -3,10 +3,27 @@ local nvim_tree_api = require("nvim-tree.api")
vim.keymap.set("n", "<Leader>ft", nvim_tree_api.tree.open)
local function kmap_opts(bufnr, desc)
return {
desc = "nvim-tree: " .. desc,
buffer = bufnr,
noremap = true,
silent = true,
nowait = true
}
end
local function on_attach(bufnr)
nvim_tree_api.config.mappings.default_on_attach(bufnr)
vim.keymap.set("n", "<ESC>", nvim_tree_api.tree.close, kmap_opts(bufnr, "Close"))
end
nvim_tree.setup({
view = {
float = {
enable = true
}
}
},
on_attach = on_attach,
})