Skip to content

Commit fb9fd53

Browse files
committed
fix(hl): highlights for Nvim v0.9
Resolves #939
1 parent 0a2a93f commit fb9fd53

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

doc/gitsigns.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -922,17 +922,17 @@ searching for other defined highlights in order.
922922
GitSignsAdd
923923
Used for the text of 'add' signs.
924924

925-
Fallbacks: `GitGutterAdd`, `SignifySignAdd`, `DiffAddedGutter`, `Added`, `DiffAdd`
925+
Fallbacks: `GitGutterAdd`, `SignifySignAdd`, `DiffAddedGutter`, `diffAdded`, `DiffAdd`
926926
*hl-GitSignsChange*
927927
GitSignsChange
928928
Used for the text of 'change' signs.
929929

930-
Fallbacks: `GitGutterChange`, `SignifySignChange`, `DiffModifiedGutter`, `Changed`, `DiffChange`
930+
Fallbacks: `GitGutterChange`, `SignifySignChange`, `DiffModifiedGutter`, `diffChanged`, `DiffChange`
931931
*hl-GitSignsDelete*
932932
GitSignsDelete
933933
Used for the text of 'delete' signs.
934934

935-
Fallbacks: `GitGutterDelete`, `SignifySignDelete`, `DiffRemovedGutter`, `Removed`, `DiffDelete`
935+
Fallbacks: `GitGutterDelete`, `SignifySignDelete`, `DiffRemovedGutter`, `diffRemoved`, `DiffDelete`
936936
*hl-GitSignsChangedelete*
937937
GitSignsChangedelete
938938
Used for the text of 'changedelete' signs.

lua/gitsigns.lua

-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ M.setup = async.void(function(cfg)
183183
require('gitsigns.git')._set_version(config._git_version)
184184
end
185185

186-
187186
if config.auto_attach then
188187
setup_attach()
189188
end

lua/gitsigns/highlight.lua

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ local api = vim.api
77
--- @field fg_factor number
88
--- @field bg_factor number
99

10+
local nvim10 = vim.fn.has('nvim-0.10') > 0
11+
1012
local M = {}
1113

1214
--- Use array of dict so we can iterate deterministically
@@ -18,7 +20,7 @@ M.hls = {
1820
'GitGutterAdd',
1921
'SignifySignAdd',
2022
'DiffAddedGutter',
21-
'Added',
23+
nvim10 and 'Added' or 'diffAdded',
2224
'DiffAdd',
2325
desc = "Used for the text of 'add' signs.",
2426
},
@@ -29,7 +31,7 @@ M.hls = {
2931
'GitGutterChange',
3032
'SignifySignChange',
3133
'DiffModifiedGutter',
32-
'Changed',
34+
nvim10 and 'Changed' or 'diffChanged',
3335
'DiffChange',
3436
desc = "Used for the text of 'change' signs.",
3537
},
@@ -40,7 +42,7 @@ M.hls = {
4042
'GitGutterDelete',
4143
'SignifySignDelete',
4244
'DiffRemovedGutter',
43-
'Removed',
45+
nvim10 and 'Removed' or 'diffRemoved',
4446
'DiffDelete',
4547
desc = "Used for the text of 'delete' signs.",
4648
},

test/gitsigns_spec.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ describe('gitsigns (with screen)', function()
6060
command('colorscheme vim')
6161
else
6262
default_attrs[2] = { background = Screen.colors.LightMagenta }
63-
default_attrs[4] = { background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 }
63+
default_attrs[4] =
64+
{ background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 }
6465
end
6566

6667
screen:set_default_attr_ids(default_attrs)

test/highlights_spec.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ describe('highlights', function()
4040
command('colorscheme vim')
4141
else
4242
default_attrs[2] = { background = Screen.colors.LightMagenta }
43-
default_attrs[4] = { background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 }
43+
default_attrs[4] =
44+
{ background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 }
4445
end
4546

4647
screen:set_default_attr_ids(default_attrs)
@@ -79,9 +80,8 @@ describe('highlights', function()
7980
p('Deriving GitSignsChangeLn from DiffChange'),
8081
p('Deriving GitSignsChangeNr from GitSignsChange'),
8182
-- TODO(lewis6991): huh?
82-
nvim10 and
83-
p('Deriving GitSignsDelete from Removed') or
84-
p('Deriving GitSignsDelete from DiffDelete'),
83+
nvim10 and p('Deriving GitSignsDelete from Removed')
84+
or p('Deriving GitSignsDelete from DiffDelete'),
8585
p('Deriving GitSignsDeleteNr from GitSignsDelete'),
8686
})
8787
end)

0 commit comments

Comments
 (0)