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:
parent
57f2fbd5fe
commit
4f67a6d3ca
2 changed files with 6 additions and 2 deletions
|
@ -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",
|
||||
|
|
|
@ -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" })
|
||||
|
|
Loading…
Reference in a new issue