From c7768913da6fba600a48fba25bc1d59e38e4274d Mon Sep 17 00:00:00 2001 From: Job Jobse Date: Wed, 23 Sep 2026 20:55:42 +0200 Subject: [PATCH] fix: add deleted git files on select --- lua/git.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/git.lua b/lua/git.lua index 83e8969..217cde1 100644 --- a/lua/git.lua +++ b/lua/git.lua @@ -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, }