fix: add deleted git files on select
This commit is contained in:
1 file changed
+7
-1
+7
-1
@@ -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,
|
||||
}
|
||||
Reference in new issue
Block a user