Skip to content

Commit

Permalink
feat: use on_load to load which-key queue automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Aug 10, 2023
1 parent 157bf02 commit 4d76f15
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/astrocore/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ end
---@param map_table table A nested table where the first key is the vim mode, the second key is the key to map, and the value is the function to set the mapping to
---@param base? table A base set of options to set on every keybinding
function M.set_mappings(map_table, base)
local was_no_which_key_queue = not M.which_key_queue
-- iterate over the first keys for each mode
base = base or {}
for mode, maps in pairs(map_table) do
Expand All @@ -288,7 +289,7 @@ function M.set_mappings(map_table, base)
end
end
end
if package.loaded["which-key"] then M.which_key_register() end -- if which-key is loaded already, register
if was_no_which_key_queue and M.which_key_queue then M.on_load("which-key.nvim", M.which_key_register) end
end

--- regex used for matching a valid URL/URI string
Expand Down

0 comments on commit 4d76f15

Please sign in to comment.