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
|
||||||
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 {
|
return {
|
||||||
status = function()
|
status = function()
|
||||||
local lines = vim.fn.systemlist('git -c core.quotepath=false status -s -u')
|
local lines = vim.fn.systemlist('git -c core.quotepath=false status -s -u')
|
||||||
@@ -33,6 +39,6 @@ return {
|
|||||||
end
|
end
|
||||||
if #items == 0 then return vim.notify('No unstaged changes', vim.log.levels.INFO) 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,
|
end,
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user