diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/plugins/lsp.lua index a1c56ae..b2478f7 100644 --- a/nvim/.config/nvim/lua/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/lsp.lua @@ -31,6 +31,11 @@ local lsp = { }, event = { "BufReadPost", "BufNewFile", "BufWritePre" }, opts = { servers = get_all_servers() }, + init = function() + if require("core.util").is_available("which-key") then + require("which-key").add({ "l", group = "language" }) + end + end, config = function(_, lspconfig_opts) -- Display diagnostics as virtual text only if not in insert mode -- /r/neovim/comments/12inp4c/disable_diagnostics_virtual_text_when_in_insert/jqqifwk/ @@ -225,9 +230,6 @@ vim.api.nvim_create_autocmd("LspAttach", { o({ desc = "Next error" }) ) - if require("core.util").is_available("which-key") then - require("which-key").add({ "l", group = "language" }) - end map("n", "ld", "lua vim.diagnostic.open_float()", o({ desc = "Show line diagnostics" })) map("n", "la", "lua vim.lsp.buf.code_action()", o({ desc = "Codeactions" })) map("n", "ln", "lua vim.lsp.buf.rename()", o({ desc = "Rename element" })) diff --git a/nvim/.config/nvim/lua/plugins/prose.lua b/nvim/.config/nvim/lua/plugins/prose.lua index 58480c9..fa1813b 100644 --- a/nvim/.config/nvim/lua/plugins/prose.lua +++ b/nvim/.config/nvim/lua/plugins/prose.lua @@ -97,6 +97,11 @@ local prose_plugs = { }, ft = md_like, cmd = "RenderMarkdown", + init = function() + if require("core.util").is_available("which-key") then + require("which-key").add({ { "p", group = "presentation" } }) + end + end, keys = { { "pm", @@ -160,6 +165,11 @@ local prose_plugs = { }, }, cmd = { "PasteImage" }, + init = function() + if require("core.util").is_available("which-key") then + require("which-key").add({ { "p", group = "presentation" } }) + end + end, keys = { { "pp", "PasteImage", desc = "Paste image from system clipboard" }, }, @@ -169,7 +179,7 @@ local prose_plugs = { -- bring zettelkasten commands { "zk-org/zk-nvim", - config = function() + init = function() if require("core.util").is_available("which-key") then require("which-key").add({ { "n", group = "notes" }, @@ -177,7 +187,8 @@ local prose_plugs = { { "n", group = "note", mode = "v" }, }) end - + end, + config = function() require("zk.commands").add("ZkOrphans", function(opts) opts = vim.tbl_extend("force", { orphan = true }, opts or {}) require("zk").edit(opts, { title = "Zk Orphans" }) diff --git a/nvim/.config/nvim/lua/plugins/testing.lua b/nvim/.config/nvim/lua/plugins/testing.lua index 1062823..ab07007 100644 --- a/nvim/.config/nvim/lua/plugins/testing.lua +++ b/nvim/.config/nvim/lua/plugins/testing.lua @@ -32,6 +32,11 @@ return { "nvim-neotest/neotest-python", }, + init = function() + if require("core.util").is_available("which-key") then + require("which-key").add({ "t", group = "test" }) + end + end, config = function() require("neotest").setup({ adapters = { @@ -41,9 +46,6 @@ return { }), }, }) - if require("core.util").is_available("which-key") then - require("which-key").add({ "t", group = "test" }) - end end, ft = { "python" }, keys = {