nvim: Fix which-key conditional usage if not loaded

The only left-over which-key invocation which did not check for its
existence beforehand.
This commit is contained in:
Marty Oehme 2024-06-07 09:55:56 +02:00
parent 57f2fbd5fe
commit 4f67a6d3ca
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
2 changed files with 6 additions and 2 deletions

View file

@ -70,7 +70,9 @@ local function on_attach(client, bufnr)
{ buffer = bufnr, desc = "Next error" }
)
require("which-key").register({ ["<localleader>l"] = { name = "+language" } })
if require("core.util").is_available("which-key") then
require("which-key").register({ ["<localleader>l"] = { name = "+language" } })
end
map(
"n",
"<localleader>ld",

View file

@ -55,7 +55,9 @@ return {
end, { expr = true, desc = "Previous git hunk" })
-- Actions
require("which-key").register({ ["<localleader>h"] = { name = "+git" } })
if require("core.util").is_available("which-key") then
require("which-key").register({ ["<localleader>h"] = { name = "+git" } })
end
map({ "n", "v" }, "<localleader>hs", ":Gitsigns stage_hunk<CR>", { desc = "stage hunk" })
map({ "n", "v" }, "<localleader>hr", ":Gitsigns reset_hunk<CR>", { desc = "reset hunk" })
map("n", "<localleader>hS", gs.stage_buffer, { desc = "stage buffer" })