feat(toggle): add which-key mappings when which-key loads

This commit is contained in:
Folke Lemaitre 2024-12-11 18:23:39 +01:00
parent f540b7b6cc
commit c9f494bd9a
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -107,8 +107,10 @@ function Toggle:map(keys, opts)
self.opts.map(mode, keys, function()
self:toggle()
end, opts)
if self.opts.which_key and pcall(require, "which-key") then
self:_wk(keys, mode)
if self.opts.which_key then
Snacks.util.on_module("which-key", function()
self:_wk(keys, mode)
end)
end
end