fix(picker): add keymaps for preview scratch buffers

This commit is contained in:
Folke Lemaitre 2025-01-19 17:33:56 +01:00
parent 924a33a167
commit dc3f114c1f
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 11 additions and 4 deletions

View file

@ -803,6 +803,16 @@ function M:show()
end,
})
self:map()
self:drop()
return self
end
function M:map()
if not self:buf_valid() then
return
end
for _, spec in pairs(self.keys) do
local opts = vim.deepcopy(spec)
opts[1] = nil
@ -828,10 +838,6 @@ function M:show()
---@cast spec snacks.win.Keys
vim.keymap.set(spec.mode or "n", spec[1], rhs, opts)
end
self:drop()
return self
end
---@private