fix: add deleted git files on select

This commit is contained in:
Job Jobse committed 2026-09-23 20:55:42 +02:00
1 parent 67be12a30c
commit c7768913da
1 file changed
+7 -1
+7 -1
View File
@@ -11,6 +11,12 @@ local function show(buf_id, items, query)
end
end
-- Deleted files can't be opened, so choosing one stages the deletion instead
local function choose(item)
if vim.uv.fs_stat(item.path) then return MiniPick.default_choose(item) end
vim.fn.system({ 'git', 'add', '--', item.path })
end
return {
status = function()
local lines = vim.fn.systemlist('git -c core.quotepath=false status -s -u')
@@ -33,6 +39,6 @@ return {
end
if #items == 0 then return vim.notify('No unstaged changes', vim.log.levels.INFO) end
MiniPick.start({ source = { items = items, name = 'Git Status', show = show } })
MiniPick.start({ source = { items = items, name = 'Git Status', show = show, choose = choose } })
end,
}