diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index 85f57a9..379f233 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -224,11 +224,11 @@ M.telescope = { -- find ["ff"] = { " Telescope find_files ", " find files" }, ["fa"] = { " Telescope find_files follow=true no_ignore=true hidden=true ", " find all" }, - ["fw"] = { " Telescope live_grep ", " live grep" }, + ["fw"] = { " Telescope live_grep ", " live grep" }, ["fb"] = { " Telescope buffers ", " find buffers" }, ["fh"] = { " Telescope help_tags ", " help page" }, - ["fo"] = { " Telescope oldfiles ", " find oldfiles" }, - ["tk"] = { " Telescope keys ", " show keys" }, + ["fo"] = { " Telescope oldfiles ", " find oldfiles" }, + ["tk"] = { " Telescope keymaps ", " show keys" }, -- git ["cm"] = { " Telescope git_commits ", " git commits" }, @@ -285,4 +285,20 @@ M.nvterm = { }, } +M.whichkey = { + n = { + ["wK"] = { + function() + vim.cmd("WhichKey") + end, " which-key all keymaps", + }, + ["wk"] = { + function() + local input = vim.fn.input("WhichKey: ") + vim.cmd("WhichKey " .. input) + end, " which-key query lookup", + }, + } +} + return M diff --git a/lua/plugins/configs/whichkey.lua b/lua/plugins/configs/whichkey.lua index 3dfd7a9..73eb042 100644 --- a/lua/plugins/configs/whichkey.lua +++ b/lua/plugins/configs/whichkey.lua @@ -61,9 +61,10 @@ local mappings = nvchad.load_config().mappings -- register mappings for mode, opt in pairs(options.mode_opts) do - for key, _ in pairs(mappings) do - if mappings[key][mode] then - wk.register(mappings[key][mode], opt) + for _, value in pairs(mappings) do + if value[mode] then + local mode_opts = value["mode_opts"] and vim.tbl_deep_extend("force", opt, value["mode_opts"]) or opt + wk.register(value[mode], mode_opts) end end end