mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-12-22 23:37:33 +00:00
Avoid wk error if not loaded when currying keymaps
I guess requiring doesn't force init. Not sure if there is a way to do that.
This commit is contained in:
parent
474cfc0604
commit
0c84a3fcd1
@ -165,12 +165,14 @@ function M.curry_keymap(mode, prefix, default_opts)
|
|||||||
default_opts = vim.tbl_extend("keep", default_opts or {}, { noremap = true, silent = true })
|
default_opts = vim.tbl_extend("keep", default_opts or {}, { noremap = true, silent = true })
|
||||||
local group_desc = M.tbl_pop(default_opts, "group_desc")
|
local group_desc = M.tbl_pop(default_opts, "group_desc")
|
||||||
if group_desc ~= nil then
|
if group_desc ~= nil then
|
||||||
|
if M.is_plugin_loaded("which-key") then
|
||||||
M.try_require("which-key", function(wk)
|
M.try_require("which-key", function(wk)
|
||||||
wk.register({
|
wk.register({
|
||||||
[prefix] = "+" .. group_desc,
|
[prefix] = "+" .. group_desc,
|
||||||
}, default_opts)
|
}, default_opts)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return function(lhs, rhs, opts)
|
return function(lhs, rhs, opts)
|
||||||
opts = vim.tbl_extend("keep", opts or {}, default_opts)
|
opts = vim.tbl_extend("keep", opts or {}, default_opts)
|
||||||
|
Loading…
Reference in New Issue
Block a user