fix(nvim-tree): use local buffer keymaps (#4090)

This commit is contained in:
CPea 2023-04-28 16:20:01 +07:00 committed by GitHub
parent 12a46fbe4f
commit 4e1db216ae
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23

View file

@ -243,17 +243,21 @@ local function on_attach(bufnr)
require("lvim.core.nvimtree").start_telescope "live_grep"
end
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
api.config.mappings.default_on_attach(bufnr)
local useful_keys = {
["l"] = api.node.open.edit,
["o"] = api.node.open.edit,
["<CR>"] = api.node.open.edit,
["v"] = api.node.open.vertical,
["h"] = api.node.navigate.parent_close,
["C"] = api.tree.change_root_to_node,
["gtg"] = telescope_live_grep,
["gtf"] = telescope_find_files,
["l"] = { api.node.open.edit, opts "Open" },
["o"] = { api.node.open.edit, opts "Open" },
["<CR>"] = { api.node.open.edit, opts "Open" },
["v"] = { api.node.open.vertical, opts "Open: Vertical Split" },
["h"] = { api.node.navigate.parent_close, opts "Close Directory" },
["C"] = { api.tree.change_root_to_node, opts "CD" },
["gtg"] = { telescope_live_grep, opts "Telescope Live Grep" },
["gtf"] = { telescope_find_files, opts "Telescope Find File" },
}
require("lvim.keymappings").load_mode("n", useful_keys)