feat: support gitsigns
This commit is contained in:
committed by
Olivier Roques
parent
dcc0294280
commit
55255ed409
@@ -1,5 +1,6 @@
|
||||
local fn = vim.fn
|
||||
local g = vim.g
|
||||
local b = vim.b
|
||||
local fmt = string.format
|
||||
|
||||
local function get_hunks()
|
||||
@@ -11,6 +12,12 @@ local function get_hunks()
|
||||
if (summary[1] == -1) then -- signify returns {-1, -1, -1} in empty buffer
|
||||
return ''
|
||||
end
|
||||
elseif b.gitsigns_status_dict ~= nil then
|
||||
local status_dict = b.gitsigns_status_dict
|
||||
if status_dict.added == nil then
|
||||
return ''
|
||||
end
|
||||
summary = {status_dict.added, status_dict.changed, status_dict.removed}
|
||||
else
|
||||
return ''
|
||||
end
|
||||
@@ -29,6 +36,8 @@ local function get_branch()
|
||||
branch = fn['gina#component#repo#branch']()
|
||||
elseif g.loaded_gitbranch then
|
||||
branch = fn['gitbranch#name']()
|
||||
elseif b.gitsigns_head ~= nil then
|
||||
branch = b.gitsigns_head
|
||||
end
|
||||
return branch ~= '' and fmt('(%s)', branch) or ''
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user