feat(nvim): read diff status from gitsigns
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Rob Watson 2023-10-22 13:11:41 +02:00
parent 57a5042860
commit 2340f9703a
1 changed files with 30 additions and 1 deletions

View File

@ -10,6 +10,14 @@ local mode_map = {
["V-LINE"] = "V-LINE", ["V-LINE"] = "V-LINE",
} }
local function format_diff_element(val, sym)
if val == nil or val < 1 then
return ""
end
return sym .. val
end
require("lualine").setup({ require("lualine").setup({
options = { options = {
icons_enabled = false, icons_enabled = false,
@ -31,7 +39,28 @@ require("lualine").setup({
"branch", "branch",
padding = { left = 0 }, padding = { left = 0 },
}, },
"diff", -- render coloured output from gitsigns, this doesn't seem to work with b:gitsigns_status:
{
function()
return format_diff_element(vim.b.gitsigns_status_dict.added, "+")
end,
color = { fg = "#a3be8c" },
padding = 0,
},
{
function()
return format_diff_element(vim.b.gitsigns_status_dict.changed, "~")
end,
color = { fg = "#ebcb8b" },
padding = 0,
},
{
function()
return format_diff_element(vim.b.gitsigns_status_dict.removed, "-")
end,
color = { fg = "#bf616a" },
padding = 0,
},
{ {
"diagnostics", "diagnostics",
sources = { "nvim_lsp" }, sources = { "nvim_lsp" },