Skip to content

Commit

Permalink
fix: remove duplicate kaymap (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimzk committed Feb 10, 2023
1 parent 684e96c commit 9a4680e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lua/which-key/keys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,18 @@ function M.get_mappings(mode, prefix_i, buf)
if value.value then
value.value = vim.fn.strtrans(value.value)
end
table.insert(tmp, value)
-- remove duplicated keymap
local exists = false
for k, v in pairs(tmp) do
if type(v) == "table" and v.key == value.key then
tmp[k] = value
exists = true
break
end
end
if not exists then
table.insert(tmp, value)
end
end
end

Expand Down

0 comments on commit 9a4680e

Please sign in to comment.