nord.nvim
nord.nvim copied to clipboard
Blame in gitsigns not visible when using cursorline
The current-line blame feature of Gitsigns is not visible when cursorline is on. Even with cursorline off, it's very hard to read. In gitsigns that text has a highlight group of GitSignsCurrentLineBlame.
Using cursorline:

No cursorline:

I can push a PR but I'm not sure what to set the colors to.
Looks like the git blame color is a bit darker then I would like it to be, and the cursorline can likely be a bit darker. That should solve both issues.
FWIW, I made this change locally. Doubt it's the right solution, but it uses a color that doesn't clash with the background or cursor line.
In the gitsigns plugin, it appears they set the blame text color as NonText. Does that mean anything to the way the theme is defined? Or does this seem like an issue that needs to be fixed in gitsigns?
$ git diff
diff --git a/lua/gitsigns/highlight.lua b/lua/gitsigns/highlight.lua
index 48c89a4..f54dfbc 100644
--- a/lua/gitsigns/highlight.lua
+++ b/lua/gitsigns/highlight.lua
@@ -36,7 +36,8 @@ local hls = {
GitSignsChangeLn = { 'GitGutterChangeLine', 'SignifyLineChange', 'DiffChange' },
GitSignsDeleteLn = { 'GitGutterDeleteLine', 'SignifyLineDelete', 'DiffDelete' },
- GitSignsCurrentLineBlame = { 'NonText' },
+ GitSignsCurrentLineBlame = { 'GitGutterAdd' },
+ -- GitSignsCurrentLineBlame = { 'NonText' },
}
local function is_hl_set(hl_name)
As a followup to this thread. When configuring gitsigns plugin, you can switch the color that is used for the blame as follows:
Wherever you configure the gitsigns plugin, define a function to handle the formatting of the blame text and in the return value, replace GitSignsCurrentLineBlame with the color you want. In the example below, I used Label.
Label is a global color defined by all themes. Works perfect for me and blends in.
local status_ok, gitsigns = pcall(require, "gitsigns")
if not status_ok then
vim.notify("gitsigns plugin not found!")
return
end
local function current_line_blame_formatter(_, blame_info, opts)
local text
if blame_info.author == "Not Committed Yet" then
text = blame_info.author
else
local date_time
if opts.relative_time then
date_time = require("gitsigns.util").get_relative_time(tonumber(blame_info["author_time"]))
else
date_time = os.date("%Y-%m-%d", tonumber(blame_info["author_time"]))
end
text = string.format("%s, %s - %s", blame_info.author, date_time, blame_info.summary)
end
return {{" " .. text, "Label"}}
end
gitsigns.setup {
current_line_blame_formatter = current_line_blame_formatter
}
Same happens with cursor over whitespace. CursorLine has guibg=#3B4252, Cursor has gui=reverse, and GitSignsCurrentLineBlame and WhiteSpace both link to NonText which has guifg=#3B4252. Currently working around it by manually doing hi NonText guifg=#4B5262.
I poked around to see if chaning the Value of NonText to something like nord.nord3_gui_bright since it will have the same color as for example comments.
I'm not quite sure if this might break something else tho. While looking around I haven't found any visual issues as far as I can tell.
diff --git a/lua/nord/theme.lua b/lua/nord/theme.lua
index d97df03..aadfd40 100644
--- a/lua/nord/theme.lua
+++ b/lua/nord/theme.lua
@@ -96,7 +96,7 @@ theme.loadEditor = function()
MatchParen = { fg = nord.nord15_gui, bg = nord.none, style = "bold" },
ModeMsg = { fg = nord.nord4_gui },
MoreMsg = { fg = nord.nord4_gui },
- NonText = { fg = nord.nord1_gui },
+ NonText = { fg = nord.nord3_gui_bright },
Pmenu = { fg = nord.nord4_gui, bg = nord.nord2_gui },
PmenuSel = { fg = nord.nord4_gui, bg = nord.nord10_gui },
PmenuSbar = { fg = nord.nord4_gui, bg = nord.nord2_gui },