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