feat(picker): added git_stash picker. Closes #762

This commit is contained in:
Folke Lemaitre 2025-01-28 16:05:30 +01:00
parent 1a5a0871c8
commit bb3db117a4
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
5 changed files with 87 additions and 4 deletions

View file

@ -307,6 +307,24 @@ function M.git_diff(ctx)
M.cmd(cmd, ctx, { ft = not native and "diff" or nil })
end
---@param ctx snacks.picker.preview.ctx
function M.git_stash(ctx)
local native = ctx.picker.opts.previewers.git.native
local cmd = {
"git",
"-c",
"delta." .. vim.o.background .. "=true",
"stash",
"show",
"--patch",
ctx.item.stash,
}
if not native then
table.insert(cmd, 2, "--no-pager")
end
M.cmd(cmd, ctx, { ft = not native and "diff" or nil })
end
---@param ctx snacks.picker.preview.ctx
function M.git_status(ctx)
local ss = ctx.item.status