Skip to content

Commit

Permalink
feat(compile): add support for grouped keys
Browse files Browse the repository at this point in the history
  • Loading branch information
musjj committed Sep 10, 2022
1 parent 6afb674 commit 3d12cd7
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lua/packer/compile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,24 @@ local function make_loaders(_, plugins, output_lua, should_profile)
plugin.keys = { plugin.keys }
end
loaders[name].keys = {}
for _, keymap in ipairs(plugin.keys) do

local keys
if vim.tbl_islist(plugin.keys) then
keys = plugin.keys
else
keys = {}
for mode, keymap in pairs(plugin.keys) do
if type(keymap) == 'string' then
table.insert(keys, { mode, keymap })
else
for _, k in ipairs(keymap) do
table.insert(keys, { mode, k })
end
end
end
end

for _, keymap in ipairs(keys) do
if type(keymap) == 'string' then
keymap = { '', keymap }
end
Expand Down

0 comments on commit 3d12cd7

Please sign in to comment.