lewis6991 / gitsigns.nvim

Git integration for buffers
MIT License
4.86k stars 186 forks source link

DiffChange is hijacked for changed line in SignColumn #1066

Closed Markuzcha closed 2 months ago

Markuzcha commented 2 months ago

Description

It looks like suddenly my color setting for 'DiffChange' is now used for the coloring of changed lines indicator in SignColumn. The other color settings 'DiffAdd' or 'DiffDelete' don't seem to affect Gitsigns line change indicators in SignColumn.

Bildschirmfoto vom 2024-06-21 22-24-41

Neovim version

v0.9.5 (LuaJIT 2.1.1702233742)

Operating system and version

Linux

Expected behavior

'DiffChange' not to affect the line change indicator, because I want to keep it this way for my diff views.

Actual behavior

'DiffChange' affects the line change indicator in SignColumn.

Minimal config

for name, url in pairs{
  gitsigns = 'https://github.com/lewis6991/gitsigns.nvim',
  ayu = 'https://github.com/Shatur/neovim-ayu'
} do
local install_path = vim.fn.fnamemodify('gitsigns_issue/'..name, ':p')
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system { 'git', 'clone', '--depth=1', url, install_path }
end
vim.opt.runtimepath:append(install_path)
end

require('gitsigns').setup()

require('ayu').colorscheme()
require('ayu').setup {
  overrides = function()
    if vim.o.background == 'dark' then
      return {
        LineNr = {fg = '#6e6e6e'},
        Normal = {fg = '#e6e1cf', bg = '#0a0e14'},
        NormalNC = {bg = '#21201c'},
        DummyDum = {bg = '#21201c'},
        SpecialKey = {fg = '#3c87d3'},
        CursorLine = {bg = '#1d222a'},
        ColorColumn = {bg = '#1f1f1f'},
        WinSeparator = {fg = '#2d5986', bg = '#0a0e14'},
        Visual = {bg = '#3d3d3d'},
        Search = {fg = '#0f1419', bg = '#ebd460'},
        DiffAdd = {fg = '#5f87af', bg = '#0a0e14'},
        DiffChange = {fg = '#5f87af', bg = '#0a0e14'},
        DiffDelete = {fg = '#5f87af', bg = '#0a0e14'},
        DiffText = {fg = '#ffee05', bg = '#e00000', bold = true},
        Directory = {fg = '#8798ab'},
        Comment = {fg = '#8b96a2'},
        Folded = {fg = '#4385cb', bg = '#14191f'},
        FoldColumn = {fg = '#7493b4', bg = '#14191f'},
      }
    else
      return { NormalNC = {bg = '#f0f0f0'} }
    end
  end
}

Steps to reproduce

  1. mkdir gitsigns_issue
  2. cd gitsigns_issue
  3. git init
  4. touch file
  5. git add file
  6. git commit -m 'initial commit'
  7. nvim --clean -u minimal.lua file
  8. Add lines
  9. commit lines
  10. change some lines
  11. delete some lines
  12. add some lines
  13. watch messed up Change line indicator in SignColumn
  14. make some changes in 'DiffChange'
  15. see how change line indicator in SignColumn changes
  16. make some changes in 'DiffAdd'
  17. see how change line indicator in SignColumn ISN'T changed
  18. same with DiffDelete

Gitsigns debug messages

No response

Gitsigns cache

No response

lewis6991 commented 2 months ago

Gitsigns has its own set of highlights defined in the docs. It will default to some fallbacks but for the best experience these need to be defined.

Markuzcha commented 2 months ago

Thank you for the quick reply. I found the missing settings for me:

GitSignsAdd = {fg = '#0cbb0c', bg = '#0a0e14'},
GitSignsChange = {fg = '#2085e9', bg = '#0a0e14'},
GitSignsDelete = {fg = '#e00000', bg = '#0a0e14'},

Yet I could omit the setting 'bg' here, as this is already set by SignColum highlight group.

Thank you very much for developing this very useful plugin working in the background, but much more needed than obvious.