From 89d4038d578b0af0b2b1f661d44f0fff061d5bc1 Mon Sep 17 00:00:00 2001 From: Ralph Date: Thu, 4 Apr 2024 08:24:42 -0700 Subject: [PATCH] nvimtree: change g? to ? for help --- lua/plugins/editor_mine.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lua/plugins/editor_mine.lua b/lua/plugins/editor_mine.lua index e3ff1e6..52b11e3 100644 --- a/lua/plugins/editor_mine.lua +++ b/lua/plugins/editor_mine.lua @@ -42,8 +42,19 @@ return { end end end, - config = function() - require("nvim-tree").setup() + opts = { + -- https://github.com/nvim-tree/nvim-tree.lua?tab=readme-ov-file#custom-mappings + on_attach = function(bufnr) + local api = require("nvim-tree.api") + 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) + vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help")) + end, + }, + config = function(_, opts) + require("nvim-tree").setup(opts) end, }, }