From 38eb3bf115f1b550e853a04545932fad3fbffe5b Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 14 Feb 2023 14:40:34 +0100 Subject: [PATCH] fix(which-key): only add noice group when noice is enabled --- lua/lazyvim/plugins/editor.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index d2c9413e..27909eb2 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -176,7 +176,7 @@ return { config = function(_, opts) local wk = require("which-key") wk.setup(opts) - wk.register({ + local keymaps = { mode = { "n", "v" }, ["g"] = { name = "+goto" }, ["gz"] = { name = "+surround" }, @@ -190,11 +190,14 @@ return { ["gh"] = { name = "+hunks" }, ["q"] = { name = "+quit/session" }, ["s"] = { name = "+search" }, - ["sn"] = { name = "+noice" }, ["u"] = { name = "+ui" }, ["w"] = { name = "+windows" }, ["x"] = { name = "+diagnostics/quickfix" }, - }) + } + if Util.has("noice.nvim") then + keymaps["sn"] = { name = "+noice" } + end + wk.register(keymaps) end, },