fix: only show non-accepted changes in fm
This commit is contained in:
+11
-9
@@ -20,16 +20,18 @@ return {
|
||||
|
||||
local items = {}
|
||||
for _, l in ipairs(lines) do
|
||||
local s = l:sub(1, 2):match('%S+')
|
||||
local p = l:sub(4):gsub('.* %-> ', ''):gsub('^"(.*)"$', '%1')
|
||||
local hl = l:sub(1, 1) ~= ' ' and l:sub(1, 1) ~= '?' and 'DiagnosticOk' or hls[s:sub(1, 1)]
|
||||
items[#items + 1] = {
|
||||
text = string.format(' %-2s %s', s == '??' and '?' or s, p),
|
||||
path = p,
|
||||
hl = hl,
|
||||
}
|
||||
-- Skip fully staged files (nothing left in the worktree column)
|
||||
if l:sub(2, 2) ~= ' ' then
|
||||
local s = l:sub(1, 2):match('%S+')
|
||||
local p = l:sub(4):gsub('.* %-> ', ''):gsub('^"(.*)"$', '%1')
|
||||
items[#items + 1] = {
|
||||
text = string.format(' %-2s %s', s == '??' and '?' or s, p),
|
||||
path = p,
|
||||
hl = hls[l:sub(2, 2)],
|
||||
}
|
||||
end
|
||||
end
|
||||
if #items == 0 then return vim.notify('No 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 } })
|
||||
end,
|
||||
|
||||
Reference in New Issue
Block a user