mirror of
https://github.com/lewis6991/gitsigns.nvim
synced 2024-09-16 14:34:09 +02:00
feat: add highlights for the current line
This commit is contained in:
parent
f4928ba14e
commit
b29cb58126
4 changed files with 122 additions and 1 deletions
|
@ -572,6 +572,7 @@ signs *gitsigns-config-signs*
|
||||||
• `GitSignsAdd` (for normal text signs)
|
• `GitSignsAdd` (for normal text signs)
|
||||||
• `GitSignsAddNr` (for signs when `config.numhl == true`)
|
• `GitSignsAddNr` (for signs when `config.numhl == true`)
|
||||||
• `GitSignsAddLn `(for signs when `config.linehl == true`)
|
• `GitSignsAddLn `(for signs when `config.linehl == true`)
|
||||||
|
• `GitSignsAddCul `(for signs when `config.culhl == true`)
|
||||||
|
|
||||||
See |gitsigns-highlight-groups|.
|
See |gitsigns-highlight-groups|.
|
||||||
|
|
||||||
|
@ -686,6 +687,16 @@ linehl *gitsigns-config-linehl*
|
||||||
the highlight group does not exist, then it is automatically defined
|
the highlight group does not exist, then it is automatically defined
|
||||||
and linked to the corresponding highlight group in `signs.*.hl`.
|
and linked to the corresponding highlight group in `signs.*.hl`.
|
||||||
|
|
||||||
|
culhl *gitsigns-config-culhl*
|
||||||
|
Type: `boolean`, Default: `false`
|
||||||
|
|
||||||
|
Enable/disable highlights for the sign column when the cursor is on
|
||||||
|
the same line.
|
||||||
|
|
||||||
|
When enabled the highlights defined in `signs.*.culhl` are used. If
|
||||||
|
the highlight group does not exist, then it is automatically defined
|
||||||
|
and linked to the corresponding highlight group in `signs.*.hl`.
|
||||||
|
|
||||||
show_deleted *gitsigns-config-show_deleted*
|
show_deleted *gitsigns-config-show_deleted*
|
||||||
Type: `boolean`, Default: `false`
|
Type: `boolean`, Default: `false`
|
||||||
|
|
||||||
|
@ -1041,6 +1052,36 @@ GitSignsUntrackedLn
|
||||||
Used for buffer line (when `config.linehl == true`) of 'untracked' signs.
|
Used for buffer line (when `config.linehl == true`) of 'untracked' signs.
|
||||||
|
|
||||||
Fallbacks: `GitSignsAddLn`
|
Fallbacks: `GitSignsAddLn`
|
||||||
|
*hl-GitSignsAddCul*
|
||||||
|
GitSignsAddCul
|
||||||
|
Used for the text of 'add' signs when the cursor is on the same line as the sign.
|
||||||
|
|
||||||
|
Fallbacks: `GitSignsAdd`
|
||||||
|
*hl-GitSignsChangeCul*
|
||||||
|
GitSignsChangeCul
|
||||||
|
Used for the text of 'change' signs when the cursor is on the same line as the sign.
|
||||||
|
|
||||||
|
Fallbacks: `GitSignsChange`
|
||||||
|
*hl-GitSignsDeleteCul*
|
||||||
|
GitSignsDeleteCul
|
||||||
|
Used for the text of 'delete' signs when the cursor is on the same line as the sign.
|
||||||
|
|
||||||
|
Fallbacks: `GitSignsDelete`
|
||||||
|
*hl-GitSignsChangedeleteCul*
|
||||||
|
GitSignsChangedeleteCul
|
||||||
|
Used for the text of 'changedelete' signs when the cursor is on the same line as the sign.
|
||||||
|
|
||||||
|
Fallbacks: `GitSignsChangeCul`
|
||||||
|
*hl-GitSignsTopdeleteCul*
|
||||||
|
GitSignsTopdeleteCul
|
||||||
|
Used for the text of 'topdelete' signs when the cursor is on the same line as the sign.
|
||||||
|
|
||||||
|
Fallbacks: `GitSignsDeleteCul`
|
||||||
|
*hl-GitSignsUntrackedCul*
|
||||||
|
GitSignsUntrackedCul
|
||||||
|
Used for the text of 'untracked' signs when the cursor is on the same line as the sign.
|
||||||
|
|
||||||
|
Fallbacks: `GitSignsAddCul`
|
||||||
*hl-GitSignsAddPreview*
|
*hl-GitSignsAddPreview*
|
||||||
GitSignsAddPreview
|
GitSignsAddPreview
|
||||||
Used for added lines in previews.
|
Used for added lines in previews.
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
--- @field text string
|
--- @field text string
|
||||||
--- @field numhl string
|
--- @field numhl string
|
||||||
--- @field linehl string
|
--- @field linehl string
|
||||||
|
--- @field culhl string
|
||||||
|
|
||||||
--- @alias Gitsigns.SignType
|
--- @alias Gitsigns.SignType
|
||||||
--- | 'add'
|
--- | 'add'
|
||||||
|
@ -60,6 +61,7 @@
|
||||||
--- @field signcolumn boolean
|
--- @field signcolumn boolean
|
||||||
--- @field numhl boolean
|
--- @field numhl boolean
|
||||||
--- @field linehl boolean
|
--- @field linehl boolean
|
||||||
|
--- @field culhl boolean
|
||||||
--- @field show_deleted boolean
|
--- @field show_deleted boolean
|
||||||
--- @field sign_priority integer
|
--- @field sign_priority integer
|
||||||
--- @field _on_attach_pre fun(bufnr: integer, callback: fun(_: table))
|
--- @field _on_attach_pre fun(bufnr: integer, callback: fun(_: table))
|
||||||
|
@ -212,36 +214,47 @@ M.schema = {
|
||||||
type = validate_signs,
|
type = validate_signs,
|
||||||
deep_extend = true,
|
deep_extend = true,
|
||||||
default = {
|
default = {
|
||||||
add = { hl = 'GitSignsAdd', text = '┃', numhl = 'GitSignsAddNr', linehl = 'GitSignsAddLn' },
|
add = {
|
||||||
|
hl = 'GitSignsAdd',
|
||||||
|
text = '┃',
|
||||||
|
numhl = 'GitSignsAddNr',
|
||||||
|
linehl = 'GitSignsAddLn',
|
||||||
|
culhl = 'GitSignsAddCul',
|
||||||
|
},
|
||||||
change = {
|
change = {
|
||||||
hl = 'GitSignsChange',
|
hl = 'GitSignsChange',
|
||||||
text = '┃',
|
text = '┃',
|
||||||
numhl = 'GitSignsChangeNr',
|
numhl = 'GitSignsChangeNr',
|
||||||
linehl = 'GitSignsChangeLn',
|
linehl = 'GitSignsChangeLn',
|
||||||
|
culhl = 'GitSignsChangeCul',
|
||||||
},
|
},
|
||||||
delete = {
|
delete = {
|
||||||
hl = 'GitSignsDelete',
|
hl = 'GitSignsDelete',
|
||||||
text = '▁',
|
text = '▁',
|
||||||
numhl = 'GitSignsDeleteNr',
|
numhl = 'GitSignsDeleteNr',
|
||||||
linehl = 'GitSignsDeleteLn',
|
linehl = 'GitSignsDeleteLn',
|
||||||
|
culhl = 'GitSignsDeleteCul',
|
||||||
},
|
},
|
||||||
topdelete = {
|
topdelete = {
|
||||||
hl = 'GitSignsTopdelete',
|
hl = 'GitSignsTopdelete',
|
||||||
text = '▔',
|
text = '▔',
|
||||||
numhl = 'GitSignsTopdeleteNr',
|
numhl = 'GitSignsTopdeleteNr',
|
||||||
linehl = 'GitSignsTopdeleteLn',
|
linehl = 'GitSignsTopdeleteLn',
|
||||||
|
culhl = 'GitSignsTopdeleteCul',
|
||||||
},
|
},
|
||||||
changedelete = {
|
changedelete = {
|
||||||
hl = 'GitSignsChangedelete',
|
hl = 'GitSignsChangedelete',
|
||||||
text = '~',
|
text = '~',
|
||||||
numhl = 'GitSignsChangedeleteNr',
|
numhl = 'GitSignsChangedeleteNr',
|
||||||
linehl = 'GitSignsChangedeleteLn',
|
linehl = 'GitSignsChangedeleteLn',
|
||||||
|
culhl = 'GitSignsChangedeleteCul',
|
||||||
},
|
},
|
||||||
untracked = {
|
untracked = {
|
||||||
hl = 'GitSignsUntracked',
|
hl = 'GitSignsUntracked',
|
||||||
text = '┆',
|
text = '┆',
|
||||||
numhl = 'GitSignsUntrackedNr',
|
numhl = 'GitSignsUntrackedNr',
|
||||||
linehl = 'GitSignsUntrackedLn',
|
linehl = 'GitSignsUntrackedLn',
|
||||||
|
culhl = 'GitSignsUntrackedCul',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
default_help = [[{
|
default_help = [[{
|
||||||
|
@ -263,6 +276,7 @@ M.schema = {
|
||||||
• `GitSignsAdd` (for normal text signs)
|
• `GitSignsAdd` (for normal text signs)
|
||||||
• `GitSignsAddNr` (for signs when `config.numhl == true`)
|
• `GitSignsAddNr` (for signs when `config.numhl == true`)
|
||||||
• `GitSignsAddLn `(for signs when `config.linehl == true`)
|
• `GitSignsAddLn `(for signs when `config.linehl == true`)
|
||||||
|
• `GitSignsAddCul `(for signs when `config.culhl == true`)
|
||||||
|
|
||||||
See |gitsigns-highlight-groups|.
|
See |gitsigns-highlight-groups|.
|
||||||
]],
|
]],
|
||||||
|
@ -277,30 +291,35 @@ M.schema = {
|
||||||
text = '┃',
|
text = '┃',
|
||||||
numhl = 'GitSignsStagedAddNr',
|
numhl = 'GitSignsStagedAddNr',
|
||||||
linehl = 'GitSignsStagedAddLn',
|
linehl = 'GitSignsStagedAddLn',
|
||||||
|
culhl = 'GitSignsStagedAddCul',
|
||||||
},
|
},
|
||||||
change = {
|
change = {
|
||||||
hl = 'GitSignsStagedChange',
|
hl = 'GitSignsStagedChange',
|
||||||
text = '┃',
|
text = '┃',
|
||||||
numhl = 'GitSignsStagedChangeNr',
|
numhl = 'GitSignsStagedChangeNr',
|
||||||
linehl = 'GitSignsStagedChangeLn',
|
linehl = 'GitSignsStagedChangeLn',
|
||||||
|
culhl = 'GitSignsStagedChangeCul',
|
||||||
},
|
},
|
||||||
delete = {
|
delete = {
|
||||||
hl = 'GitSignsStagedDelete',
|
hl = 'GitSignsStagedDelete',
|
||||||
text = '▁',
|
text = '▁',
|
||||||
numhl = 'GitSignsStagedDeleteNr',
|
numhl = 'GitSignsStagedDeleteNr',
|
||||||
linehl = 'GitSignsStagedDeleteLn',
|
linehl = 'GitSignsStagedDeleteLn',
|
||||||
|
culhl = 'GitSignsStagedDeleteCul',
|
||||||
},
|
},
|
||||||
topdelete = {
|
topdelete = {
|
||||||
hl = 'GitSignsStagedTopdelete',
|
hl = 'GitSignsStagedTopdelete',
|
||||||
text = '▔',
|
text = '▔',
|
||||||
numhl = 'GitSignsStagedTopdeleteNr',
|
numhl = 'GitSignsStagedTopdeleteNr',
|
||||||
linehl = 'GitSignsStagedTopdeleteLn',
|
linehl = 'GitSignsStagedTopdeleteLn',
|
||||||
|
culhl = 'GitSignsStagedTopdeleteCul',
|
||||||
},
|
},
|
||||||
changedelete = {
|
changedelete = {
|
||||||
hl = 'GitSignsStagedChangedelete',
|
hl = 'GitSignsStagedChangedelete',
|
||||||
text = '~',
|
text = '~',
|
||||||
numhl = 'GitSignsStagedChangedeleteNr',
|
numhl = 'GitSignsStagedChangedeleteNr',
|
||||||
linehl = 'GitSignsStagedChangedeleteLn',
|
linehl = 'GitSignsStagedChangedeleteLn',
|
||||||
|
culhl = 'GitSignsStagedChangedeleteCul',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
default_help = [[{
|
default_help = [[{
|
||||||
|
@ -458,6 +477,19 @@ M.schema = {
|
||||||
]],
|
]],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
culhl = {
|
||||||
|
type = 'boolean',
|
||||||
|
default = false,
|
||||||
|
description = [[
|
||||||
|
Enable/disable highlights for the sign column when the cursor is on
|
||||||
|
the same line.
|
||||||
|
|
||||||
|
When enabled the highlights defined in `signs.*.culhl` are used. If
|
||||||
|
the highlight group does not exist, then it is automatically defined
|
||||||
|
and linked to the corresponding highlight group in `signs.*.hl`.
|
||||||
|
]],
|
||||||
|
},
|
||||||
|
|
||||||
show_deleted = {
|
show_deleted = {
|
||||||
type = 'boolean',
|
type = 'boolean',
|
||||||
default = false,
|
default = false,
|
||||||
|
|
|
@ -135,6 +135,48 @@ M.hls = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
GitSignsAddCul = {
|
||||||
|
'GitSignsAdd',
|
||||||
|
desc = "Used for the text of 'add' signs when the cursor is on the same line as the sign.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
GitSignsChangeCul = {
|
||||||
|
'GitSignsChange',
|
||||||
|
desc = "Used for the text of 'change' signs when the cursor is on the same line as the sign.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
GitSignsDeleteCul = {
|
||||||
|
'GitSignsDelete',
|
||||||
|
desc = "Used for the text of 'delete' signs when the cursor is on the same line as the sign.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
GitSignsChangedeleteCul = {
|
||||||
|
'GitSignsChangeCul',
|
||||||
|
desc = "Used for the text of 'changedelete' signs when the cursor is on the same line as the sign.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
GitSignsTopdeleteCul = {
|
||||||
|
'GitSignsDeleteCul',
|
||||||
|
desc = "Used for the text of 'topdelete' signs when the cursor is on the same line as the sign.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
GitSignsUntrackedCul = {
|
||||||
|
'GitSignsAddCul',
|
||||||
|
desc = "Used for the text of 'untracked' signs when the cursor is on the same line as the sign.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
-- Don't set GitSignsDeleteLn by default
|
-- Don't set GitSignsDeleteLn by default
|
||||||
-- {GitSignsDeleteLn = {}},
|
-- {GitSignsDeleteLn = {}},
|
||||||
|
|
||||||
|
@ -153,6 +195,11 @@ M.hls = {
|
||||||
{ GitSignsStagedDeleteLn = { 'GitSignsDeleteLn', fg_factor = 0.5, hidden = true } },
|
{ GitSignsStagedDeleteLn = { 'GitSignsDeleteLn', fg_factor = 0.5, hidden = true } },
|
||||||
{ GitSignsStagedChangedeleteLn = { 'GitSignsChangedeleteLn', fg_factor = 0.5, hidden = true } },
|
{ GitSignsStagedChangedeleteLn = { 'GitSignsChangedeleteLn', fg_factor = 0.5, hidden = true } },
|
||||||
{ GitSignsStagedTopdeleteLn = { 'GitSignsTopdeleteLn', fg_factor = 0.5, hidden = true } },
|
{ GitSignsStagedTopdeleteLn = { 'GitSignsTopdeleteLn', fg_factor = 0.5, hidden = true } },
|
||||||
|
{ GitSignsStagedAddCul = { 'GitSignsAddCul', fg_factor = 0.5, hidden = true } },
|
||||||
|
{ GitSignsStagedChangeCul = { 'GitSignsChangeCul', fg_factor = 0.5, hidden = true } },
|
||||||
|
{ GitSignsStagedDeleteCul = { 'GitSignsDeleteCul', fg_factor = 0.5, hidden = true } },
|
||||||
|
{ GitSignsStagedChangedeleteCul = { 'GitSignsStagedChangeCul', fg_factor = 0.5, hidden = true } },
|
||||||
|
{ GitSignsStagedTopdeleteCul = { 'GitSignsStagedDeleteCul', fg_factor = 0.5, hidden = true } },
|
||||||
|
|
||||||
{
|
{
|
||||||
GitSignsAddPreview = {
|
GitSignsAddPreview = {
|
||||||
|
|
|
@ -65,6 +65,7 @@ function M:add(bufnr, signs)
|
||||||
sign_hl_group = hls.hl,
|
sign_hl_group = hls.hl,
|
||||||
number_hl_group = config.numhl and hls.numhl or nil,
|
number_hl_group = config.numhl and hls.numhl or nil,
|
||||||
line_hl_group = config.linehl and hls.linehl or nil,
|
line_hl_group = config.linehl and hls.linehl or nil,
|
||||||
|
cursorline_hl_group = config.culhl and hls.culhl or nil,
|
||||||
})
|
})
|
||||||
|
|
||||||
if not ok and config.debug_mode then
|
if not ok and config.debug_mode then
|
||||||
|
|
Loading…
Reference in a new issue