Don't show signify status symbols if the count < 1 (#83)

* Don't show signify status symbols if the count < 1
This commit is contained in:
Beau 2021-02-05 08:12:35 +11:00 committed by GitHub
parent 1ade51b53d
commit 5b812b307a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 5 deletions

View File

@ -2,12 +2,29 @@ local function signify()
if vim.fn.exists('*sy#repo#get_stats') == 0 then return '' end if vim.fn.exists('*sy#repo#get_stats') == 0 then return '' end
local added, modified, removed = unpack(vim.fn['sy#repo#get_stats']()) local added, modified, removed = unpack(vim.fn['sy#repo#get_stats']())
if added == -1 then return '' end if added == -1 then return '' end
local data = { local symbols = {
'+'..added, '+',
'-'..removed, '-',
'~'..modified, '~',
} }
return table.concat(data, ' ') local result = {}
local data = {
added,
removed,
modified,
}
for range=1,3 do
if data[range] ~= nil and data[range] > 0
then table.insert(result,symbols[range]..''..data[range]..' ')
end
end end
if result[1] ~= nil then
return table.concat(result, '')
else
return ''
end
end
return signify return signify