Skip to content

Commit

Permalink
fix(keys): don't show empty groups
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jul 14, 2023
1 parent f61da3a commit 8503c0d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/which-key/keys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ function M.get_mappings(mode, prefix_i, buf)
ret.mapping = vim.tbl_deep_extend("force", {}, ret.mapping or {}, node.mapping)
end
for k, child in pairs(node.children) do
if child.mapping and child.mapping.label ~= "which_key_ignore" and child.mapping.desc ~= "which_key_ignore" then
if
child.mapping
and child.mapping.label ~= "which_key_ignore"
and child.mapping.desc ~= "which_key_ignore"
and not (child.mapping.group and vim.tbl_isempty(child.children))
then
ret.mappings[k] = vim.tbl_deep_extend("force", {}, ret.mappings[k] or {}, child.mapping)
end
end
Expand Down

0 comments on commit 8503c0d

Please sign in to comment.