Skip to content

Commit

Permalink
fix(hl): highlights for Nvim v0.9
Browse files Browse the repository at this point in the history
Resolves #939
  • Loading branch information
lewis6991 committed Jan 26, 2024
1 parent 0a2a93f commit fb9fd53
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
6 changes: 3 additions & 3 deletions doc/gitsigns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -922,17 +922,17 @@ searching for other defined highlights in order.
GitSignsAdd
Used for the text of 'add' signs.

Fallbacks: `GitGutterAdd`, `SignifySignAdd`, `DiffAddedGutter`, `Added`, `DiffAdd`
Fallbacks: `GitGutterAdd`, `SignifySignAdd`, `DiffAddedGutter`, `diffAdded`, `DiffAdd`
*hl-GitSignsChange*
GitSignsChange
Used for the text of 'change' signs.

Fallbacks: `GitGutterChange`, `SignifySignChange`, `DiffModifiedGutter`, `Changed`, `DiffChange`
Fallbacks: `GitGutterChange`, `SignifySignChange`, `DiffModifiedGutter`, `diffChanged`, `DiffChange`
*hl-GitSignsDelete*
GitSignsDelete
Used for the text of 'delete' signs.

Fallbacks: `GitGutterDelete`, `SignifySignDelete`, `DiffRemovedGutter`, `Removed`, `DiffDelete`
Fallbacks: `GitGutterDelete`, `SignifySignDelete`, `DiffRemovedGutter`, `diffRemoved`, `DiffDelete`
*hl-GitSignsChangedelete*
GitSignsChangedelete
Used for the text of 'changedelete' signs.
Expand Down
1 change: 0 additions & 1 deletion lua/gitsigns.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ M.setup = async.void(function(cfg)
require('gitsigns.git')._set_version(config._git_version)
end


if config.auto_attach then
setup_attach()
end
Expand Down
8 changes: 5 additions & 3 deletions lua/gitsigns/highlight.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ local api = vim.api
--- @field fg_factor number
--- @field bg_factor number

local nvim10 = vim.fn.has('nvim-0.10') > 0

local M = {}

--- Use array of dict so we can iterate deterministically
Expand All @@ -18,7 +20,7 @@ M.hls = {
'GitGutterAdd',
'SignifySignAdd',
'DiffAddedGutter',
'Added',
nvim10 and 'Added' or 'diffAdded',
'DiffAdd',
desc = "Used for the text of 'add' signs.",
},
Expand All @@ -29,7 +31,7 @@ M.hls = {
'GitGutterChange',
'SignifySignChange',
'DiffModifiedGutter',
'Changed',
nvim10 and 'Changed' or 'diffChanged',
'DiffChange',
desc = "Used for the text of 'change' signs.",
},
Expand All @@ -40,7 +42,7 @@ M.hls = {
'GitGutterDelete',
'SignifySignDelete',
'DiffRemovedGutter',
'Removed',
nvim10 and 'Removed' or 'diffRemoved',
'DiffDelete',
desc = "Used for the text of 'delete' signs.",
},
Expand Down
3 changes: 2 additions & 1 deletion test/gitsigns_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ describe('gitsigns (with screen)', function()
command('colorscheme vim')
else
default_attrs[2] = { background = Screen.colors.LightMagenta }
default_attrs[4] = { background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 }
default_attrs[4] =
{ background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 }
end

screen:set_default_attr_ids(default_attrs)
Expand Down
8 changes: 4 additions & 4 deletions test/highlights_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ describe('highlights', function()
command('colorscheme vim')
else
default_attrs[2] = { background = Screen.colors.LightMagenta }
default_attrs[4] = { background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 }
default_attrs[4] =
{ background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 }
end

screen:set_default_attr_ids(default_attrs)
Expand Down Expand Up @@ -79,9 +80,8 @@ describe('highlights', function()
p('Deriving GitSignsChangeLn from DiffChange'),
p('Deriving GitSignsChangeNr from GitSignsChange'),
-- TODO(lewis6991): huh?
nvim10 and
p('Deriving GitSignsDelete from Removed') or
p('Deriving GitSignsDelete from DiffDelete'),
nvim10 and p('Deriving GitSignsDelete from Removed')
or p('Deriving GitSignsDelete from DiffDelete'),
p('Deriving GitSignsDeleteNr from GitSignsDelete'),
})
end)
Expand Down

0 comments on commit fb9fd53

Please sign in to comment.