Fix snack picker breaking change

This commit is contained in:
2025-11-14 23:13:31 +01:00
parent 9aec0768ae
commit 34faa25d3a

View File

@@ -1,9 +1,9 @@
local function git_show(ref) local function git_show(ref)
local git_root = Snacks.git.get_root() local git_root = Snacks.git.get_root()
local function finder(opts, ctx) ---@type snacks.picker.finder
return require("snacks.picker.source.proc").proc({ local function finder(_opts, ctx)
opts, return require("snacks.picker.source.proc").proc(
{ ctx:opts({
cmd = "git", cmd = "git",
args = { "show", "--name-status", "--pretty=tformat:", ref }, args = { "show", "--name-status", "--pretty=tformat:", ref },
cwd = Snacks.git.get_root(), cwd = Snacks.git.get_root(),
@@ -12,8 +12,9 @@ local function git_show(ref)
item.file = string.sub(item.text, 3) item.file = string.sub(item.text, 3)
item.commit = ref item.commit = ref
end, end,
}, }),
}, ctx) ctx
)
end end
Snacks.picker.pick({ Snacks.picker.pick({
@@ -263,19 +264,19 @@ return {
end, { desc = "Grep" }) end, { desc = "Grep" })
vim.keymap.set("n", "<leader>gl", function() vim.keymap.set("n", "<leader>gl", function()
Snacks.picker.git_log({cwd = Snacks.git.get_root() }) Snacks.picker.git_log({ cwd = Snacks.git.get_root() })
end, { desc = "Git log" }) end, { desc = "Git log" })
vim.keymap.set("n", "<leader>gh", function() vim.keymap.set("n", "<leader>gh", function()
Snacks.picker.git_log_file({cwd = Snacks.git.get_root() }) Snacks.picker.git_log_file({ cwd = Snacks.git.get_root() })
end, { desc = "Git logs buffer" }) end, { desc = "Git logs buffer" })
vim.keymap.set("n", "<leader>gB", function() vim.keymap.set("n", "<leader>gB", function()
Snacks.picker.git_branches({cwd = Snacks.git.get_root() }) Snacks.picker.git_branches({ cwd = Snacks.git.get_root() })
end, { desc = "Git branches" }) end, { desc = "Git branches" })
vim.keymap.set("n", "<leader>gs", function() vim.keymap.set("n", "<leader>gs", function()
Snacks.picker.git_status({cwd = Snacks.git.get_root() }) Snacks.picker.git_status({ cwd = Snacks.git.get_root() })
end, { desc = "Git status" }) end, { desc = "Git status" })
end, end,
}, },