[2025-04-25] Fix bug with untracked files in statusline
This commit is contained in:
parent
f8c9b525ca
commit
728a618190
1 changed files with 14 additions and 2 deletions
|
@ -61,19 +61,31 @@ GetGitStatus = function()
|
||||||
local signs = vim.b.gitsigns_status_dict or {head = '', added = 0, changed = 0, removed = 0}
|
local signs = vim.b.gitsigns_status_dict or {head = '', added = 0, changed = 0, removed = 0}
|
||||||
local inRepo = signs.head ~= ''
|
local inRepo = signs.head ~= ''
|
||||||
|
|
||||||
return inRepo and string.format(
|
if inRepo and signs.added ~= nil then
|
||||||
|
return string.format(
|
||||||
'%s%s%s%s',
|
'%s%s%s%s',
|
||||||
Highlight(" {↣"..signs.head.."}","StatusLineGit"),
|
Highlight(" {↣"..signs.head.."}","StatusLineGit"),
|
||||||
Highlight(" +"..signs.added,"StatusLineGitAdd"),
|
Highlight(" +"..signs.added,"StatusLineGitAdd"),
|
||||||
Highlight(" ~"..signs.changed,"StatusLineGitChange"),
|
Highlight(" ~"..signs.changed,"StatusLineGitChange"),
|
||||||
Highlight(" -"..signs.removed.." ","StatusLineGitDelete")
|
Highlight(" -"..signs.removed.." ","StatusLineGitDelete")
|
||||||
) or string.format(
|
)
|
||||||
|
elseif inRepo and signs.added == nil then
|
||||||
|
return string.format(
|
||||||
|
'%s%s%s%s',
|
||||||
|
Highlight(" {↣"..signs.head.." -- untracked}","StatusLineGit"),
|
||||||
|
Highlight(" +0","StatusLineGitAdd"),
|
||||||
|
Highlight(" ~0","StatusLineGitChange"),
|
||||||
|
Highlight(" -0 ","StatusLineGitDelete")
|
||||||
|
)
|
||||||
|
else
|
||||||
|
return string.format(
|
||||||
'%s%s%s%s',
|
'%s%s%s%s',
|
||||||
Highlight(" {↣}","StatusLineGit"),
|
Highlight(" {↣}","StatusLineGit"),
|
||||||
Highlight(" +0","StatusLineGitAdd"),
|
Highlight(" +0","StatusLineGitAdd"),
|
||||||
Highlight(" ~0","StatusLineGitChange"),
|
Highlight(" ~0","StatusLineGitChange"),
|
||||||
Highlight(" -0 ","StatusLineGitDelete")
|
Highlight(" -0 ","StatusLineGitDelete")
|
||||||
)
|
)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue