2021-01-03 23:37:49 +00:00
|
|
|
local function signify()
|
|
|
|
if vim.fn.exists('*sy#repo#get_stats') == 0 then return '' end
|
|
|
|
local added, modified, removed = unpack(vim.fn['sy#repo#get_stats']())
|
2021-01-11 02:44:53 +00:00
|
|
|
if added == -1 then return '' end
|
2021-02-04 21:12:35 +00:00
|
|
|
local symbols = {
|
|
|
|
'+',
|
|
|
|
'-',
|
|
|
|
'~',
|
|
|
|
}
|
|
|
|
local result = {}
|
2021-01-04 01:14:29 +00:00
|
|
|
local data = {
|
2021-02-04 21:12:35 +00:00
|
|
|
added,
|
|
|
|
removed,
|
|
|
|
modified,
|
2021-01-04 01:14:29 +00:00
|
|
|
}
|
2021-02-04 21:12:35 +00:00
|
|
|
for range=1,3 do
|
|
|
|
if data[range] ~= nil and data[range] > 0
|
|
|
|
then table.insert(result,symbols[range]..''..data[range]..' ')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if result[1] ~= nil then
|
|
|
|
return table.concat(result, '')
|
|
|
|
else
|
|
|
|
return ''
|
|
|
|
end
|
2021-01-03 23:37:49 +00:00
|
|
|
end
|
|
|
|
|
2021-02-04 21:12:35 +00:00
|
|
|
|
2021-01-03 23:37:49 +00:00
|
|
|
return signify
|