From 4f80d77e6906982eb9286b6cb5b1faf43b6c487c Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Mon, 3 Jan 2022 10:06:33 -0500 Subject: [PATCH] leader / to comment --- lua/user/whichkey.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lua/user/whichkey.lua b/lua/user/whichkey.lua index 994435f..0056e5a 100644 --- a/lua/user/whichkey.lua +++ b/lua/user/whichkey.lua @@ -79,6 +79,7 @@ local opts = { } local mappings = { + ["/"] = { "lua require(\"Comment.api\").toggle_current_linewise()", "Comment" }, ["a"] = { "Alpha", "Alpha" }, ["b"] = { "lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{previewer = false})", @@ -183,5 +184,18 @@ local mappings = { }, } +local vopts = { + mode = "v", -- VISUAL mode + prefix = "", + buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings + silent = true, -- use `silent` when creating keymaps + noremap = true, -- use `noremap` when creating keymaps + nowait = true, -- use `nowait` when creating keymaps +} +local vmappings = { + ["/"] = { "lua require(\"Comment.api\").toggle_linewise_op(vim.fn.visualmode())", "Comment" }, +} + which_key.setup(setup) which_key.register(mappings, opts) +which_key.register(vmappings, vopts)