feat(picker.keymaps): improvements to keymaps picker

This commit is contained in:
Folke Lemaitre 2025-01-23 09:14:29 +01:00
parent bc47e0b1dd
commit 2762c37eb0
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
5 changed files with 29 additions and 2 deletions

View file

@ -237,11 +237,16 @@ function M.keymaps(opts)
local done = {} ---@type table<string, boolean>
for _, km in ipairs(maps) do
local key = Snacks.picker.util.text(km, { "mode", "lhs", "buffer" })
if not done[key] then
local keep = true
if opts.plugs == false and km.lhs:match("^<Plug>") then
keep = false
end
if keep and not done[key] then
done[key] = true
local item = {
mode = km.mode,
item = km,
key = km.lhs,
preview = {
text = vim.inspect(km),
ft = "lua",