This commit is contained in:
Olivier Roques
2020-12-25 21:54:44 +01:00
parent b2e6e5b652
commit 3f8e61a4e4
10 changed files with 138 additions and 80 deletions

View File

@@ -5,20 +5,22 @@ local function get_hunks()
if not g.loaded_gitgutter then return '' end
local summary = fn.GitGutterGetHunkSummary()
return table.concat({
string.format('+%d', summary[1]), ' ',
string.format('~%d', summary[2]), ' ',
string.format('-%d', summary[3]), ' ',
})
string.format('+%d', summary[1]),
string.format('~%d', summary[2]),
string.format('-%d', summary[3]),
}, ' ')
end
local function get_branch()
if not g.loaded_gitgutter then return '' end
return string.format('(%s)', fn.FugitiveHead())
local branch = fn.FugitiveHead()
return branch ~= '' and string.format('(%s)', branch) or ''
end
local function get_item()
local item = table.concat({' ', get_hunks(), get_branch(), ' '})
return item == ' ' and '' or item
local hunks, branch = get_hunks(), get_branch()
if branch == '' then return '' end
return table.concat({hunks, ' ' .. branch})
end
return {