Skip to content

Commit 3d12cd7

Browse files
committed
feat(compile): add support for grouped keys
1 parent 6afb674 commit 3d12cd7

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

lua/packer/compile.lua

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,24 @@ local function make_loaders(_, plugins, output_lua, should_profile)
422422
plugin.keys = { plugin.keys }
423423
end
424424
loaders[name].keys = {}
425-
for _, keymap in ipairs(plugin.keys) do
425+
426+
local keys
427+
if vim.tbl_islist(plugin.keys) then
428+
keys = plugin.keys
429+
else
430+
keys = {}
431+
for mode, keymap in pairs(plugin.keys) do
432+
if type(keymap) == 'string' then
433+
table.insert(keys, { mode, keymap })
434+
else
435+
for _, k in ipairs(keymap) do
436+
table.insert(keys, { mode, k })
437+
end
438+
end
439+
end
440+
end
441+
442+
for _, keymap in ipairs(keys) do
426443
if type(keymap) == 'string' then
427444
keymap = { '', keymap }
428445
end

0 commit comments

Comments
 (0)