Add escape keymap to close nvim-tree
This commit is contained in:
parent
1b1087ef55
commit
89a5ae5140
@ -3,10 +3,27 @@ local nvim_tree_api = require("nvim-tree.api")
|
|||||||
|
|
||||||
vim.keymap.set("n", "<Leader>ft", nvim_tree_api.tree.open)
|
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({
|
nvim_tree.setup({
|
||||||
view = {
|
view = {
|
||||||
float = {
|
float = {
|
||||||
enable = true
|
enable = true
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
on_attach = on_attach,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user