Closed toastal closed 8 months ago
You can use diff components with other sources instead of the one it integrates. The short-circuit is already there. When source option is given lualine no longer keeps track of diff counts itself.
here's an example with gitsigns https://github.com/nvim-lualine/lualine.nvim/wiki/Component-snippets#using-external-source-for-diff
I believe signify provides a vim function sy#repo#get_stats()
to get it's internal counts.
Oh that is good to see. I missed that section of the README. Thanks.
@shadmansaleh
local function diff_source()
if vim.fn.exists('*sy#repo#get_stats') == 1 then
local stats = vim.fn['sy#repo#get_stats']()
return {
added = stats[1],
modified = stats[2],
removed = stats[3],
}
end
end
Could be added to the Wiki entry for signify
Sure.
Edit: Added
Requested feature
When signify (or gitgutter or others) plugin is present, use its values for the diff UI.
Motivation
I understand the desire to drop dependencies (see #87), but this means a) duplicate work is being done to calculate those diff values for users with the plugin installed & b) signify, unlike lualine, supports a host of other VCS (i.e. darcs, Mercurial, et al.) whose values are not shown in the UI. This project could duplicate all those calculations for all the VCS …or just ask the other plugin.
Prior art
galaxyline just plucks these values from plugins … this could be used as a short-circuit before lualine tries to make these calculations https://github.com/nvimdev/galaxyline.nvim/blob/20f5f750002532a35193f55cd499074fc97d933d/lua/galaxyline/provider_vcs.lua#L178-L198