mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
feat(picker): added git_stash
picker. Closes #762
This commit is contained in:
parent
1a5a0871c8
commit
bb3db117a4
5 changed files with 87 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue