Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(extension): Make which_key extension respect auto_register config #418

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions lua/legendary/extensions/which_key.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ return function(opts)
end
end

local original = wk.register
local listener = function(whichkey_tbls, whichkey_opts)
Log.trace('Preparing to register items from which-key.nvim automatically')
util.bind_whichkey(whichkey_tbls, whichkey_opts, opts.do_binding, opts.use_groups)
original(whichkey_tbls, whichkey_opts)
Log.trace('Successfully registered items from which-key.nvim')
if opts.auto_register then
local original = wk.register
local listener = function(whichkey_tbls, whichkey_opts)
Log.trace('Preparing to register items from which-key.nvim automatically')
util.bind_whichkey(whichkey_tbls, whichkey_opts, opts.do_binding, opts.use_groups)
original(whichkey_tbls, whichkey_opts)
Log.trace('Successfully registered items from which-key.nvim')
end
wk.register = listener
end
wk.register = listener
else
Log.warn(
'which-key.nvim not available. If you are lazy-loading, be sure that which-key.nvim is added to runtime path '
Expand Down
Loading