nvim: Only register markdown which-keys if available

Check for availability of which-key plugin before setting up layer
key descriptions.
This commit is contained in:
Marty Oehme 2024-06-06 15:40:01 +02:00
parent 405af0f020
commit 989081abfc
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -1,6 +1,9 @@
local map = vim.keymap.set local map = vim.keymap.set
require("which-key").register({ ["<localleader>c"] = { name = "+md-code" } })
if require("core.util").is_available("which-key") then
require("which-key").register({ ["<localleader>c"] = { name = "+codecells" } })
require("which-key").register({ ["<localleader>e"] = { name = "+criticmarkup" } }) require("which-key").register({ ["<localleader>e"] = { name = "+criticmarkup" } })
end
if require("zk.util").notebook_root(vim.fn.expand("%:p")) ~= nil then if require("zk.util").notebook_root(vim.fn.expand("%:p")) ~= nil then
map("n", "<CR>", "<cmd>lua vim.lsp.buf.definition()<cr>", { silent = true }) map("n", "<CR>", "<cmd>lua vim.lsp.buf.definition()<cr>", { silent = true })