Skip to content

Commit 4d76f15

Browse files
committed
feat: use on_load to load which-key queue automatically
1 parent 157bf02 commit 4d76f15

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lua/astrocore/init.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ end
263263
---@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
264264
---@param base? table A base set of options to set on every keybinding
265265
function M.set_mappings(map_table, base)
266+
local was_no_which_key_queue = not M.which_key_queue
266267
-- iterate over the first keys for each mode
267268
base = base or {}
268269
for mode, maps in pairs(map_table) do
@@ -288,7 +289,7 @@ function M.set_mappings(map_table, base)
288289
end
289290
end
290291
end
291-
if package.loaded["which-key"] then M.which_key_register() end -- if which-key is loaded already, register
292+
if was_no_which_key_queue and M.which_key_queue then M.on_load("which-key.nvim", M.which_key_register) end
292293
end
293294

294295
--- regex used for matching a valid URL/URI string

0 commit comments

Comments
 (0)