don't fail keymaps if plugins aren't installed
This commit is contained in:
parent
9bad8de707
commit
eb0dd08f70
1 changed files with 23 additions and 11 deletions
|
@ -129,15 +129,27 @@ keymap("i", "<M-k>", "<C-o>gk", opts)
|
||||||
-- vim.keymap.set('n', '<Leader>hb', function() gs.blame_line{full=false} end, opts)
|
-- vim.keymap.set('n', '<Leader>hb', function() gs.blame_line{full=false} end, opts)
|
||||||
-- vim.keymap.set('n', '<Leader>hB', function() gs.blame_line{full=true} end, opts)
|
-- vim.keymap.set('n', '<Leader>hB', function() gs.blame_line{full=true} end, opts)
|
||||||
|
|
||||||
local wk = require("which-key")
|
local function otherkeymaps()
|
||||||
local gs = require("gitsigns")
|
local ok
|
||||||
wk.register({
|
local wk
|
||||||
g = {
|
local gs
|
||||||
name = "gitsigns",
|
ok, wk = pcall(require, "which-key")
|
||||||
p = { "<cmd>Gitsigns preview_hunk<cr>", "Preview hunk" },
|
if not ok then
|
||||||
b = { function() gs.blame_line{full=false} end, "Blame line (short)" },
|
return
|
||||||
B = { function() gs.blame_line{full=true} end, "Blame line (full)" }
|
end
|
||||||
},
|
ok, gs = pcall(require, "gitsigns")
|
||||||
prefix = "<leader>"
|
if not ok then
|
||||||
})
|
return
|
||||||
|
end
|
||||||
|
wk.register({
|
||||||
|
g = {
|
||||||
|
name = "gitsigns",
|
||||||
|
p = { "<cmd>Gitsigns preview_hunk<cr>", "Preview hunk" },
|
||||||
|
b = { function() gs.blame_line{full=false} end, "Blame line (short)" },
|
||||||
|
B = { function() gs.blame_line{full=true} end, "Blame line (full)" }
|
||||||
|
},
|
||||||
|
prefix = "<leader>"
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
otherkeymaps()
|
||||||
|
|
Loading…
Reference in a new issue