mirror of
https://github.com/lewis6991/gitsigns.nvim
synced 2024-09-08 02:35:46 +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)
|
||||
• `GitSignsAddNr` (for signs when `config.numhl == true`)
|
||||
• `GitSignsAddLn `(for signs when `config.linehl == true`)
|
||||
• `GitSignsAddCul `(for signs when `config.culhl == true`)
|
||||
|
||||
See |gitsigns-highlight-groups|.
|
||||
|
||||
|
@ -686,6 +687,16 @@ linehl *gitsigns-config-linehl*
|
|||
the highlight group does not exist, then it is automatically defined
|
||||
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*
|
||||
Type: `boolean`, Default: `false`
|
||||
|
||||
|
@ -1041,6 +1052,36 @@ GitSignsUntrackedLn
|
|||
Used for buffer line (when `config.linehl == true`) of 'untracked' signs.
|
||||
|
||||
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*
|
||||
GitSignsAddPreview
|
||||
Used for added lines in previews.
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
--- @field text string
|
||||
--- @field numhl string
|
||||
--- @field linehl string
|
||||
--- @field culhl string
|
||||
|
||||
--- @alias Gitsigns.SignType
|
||||
--- | 'add'
|
||||
|
@ -60,6 +61,7 @@
|
|||
--- @field signcolumn boolean
|
||||
--- @field numhl boolean
|
||||
--- @field linehl boolean
|
||||
--- @field culhl boolean
|
||||
--- @field show_deleted boolean
|
||||
--- @field sign_priority integer
|
||||
--- @field _on_attach_pre fun(bufnr: integer, callback: fun(_: table))
|
||||
|
@ -212,36 +214,47 @@ M.schema = {
|
|||
type = validate_signs,
|
||||
deep_extend = true,
|
||||
default = {
|
||||
add = { hl = 'GitSignsAdd', text = '┃', numhl = 'GitSignsAddNr', linehl = 'GitSignsAddLn' },
|
||||
add = {
|
||||
hl = 'GitSignsAdd',
|
||||
text = '┃',
|
||||
numhl = 'GitSignsAddNr',
|
||||
linehl = 'GitSignsAddLn',
|
||||
culhl = 'GitSignsAddCul',
|
||||
},
|
||||
change = {
|
||||
hl = 'GitSignsChange',
|
||||
text = '┃',
|
||||
numhl = 'GitSignsChangeNr',
|
||||
linehl = 'GitSignsChangeLn',
|
||||
culhl = 'GitSignsChangeCul',
|
||||
},
|
||||
delete = {
|
||||
hl = 'GitSignsDelete',
|
||||
text = '▁',
|
||||
numhl = 'GitSignsDeleteNr',
|
||||
linehl = 'GitSignsDeleteLn',
|
||||
culhl = 'GitSignsDeleteCul',
|
||||
},
|
||||
topdelete = {
|
||||
hl = 'GitSignsTopdelete',
|
||||
text = '▔',
|
||||
numhl = 'GitSignsTopdeleteNr',
|
||||
linehl = 'GitSignsTopdeleteLn',
|
||||
culhl = 'GitSignsTopdeleteCul',
|
||||
},
|
||||
changedelete = {
|
||||
hl = 'GitSignsChangedelete',
|
||||
text = '~',
|
||||
numhl = 'GitSignsChangedeleteNr',
|
||||
linehl = 'GitSignsChangedeleteLn',
|
||||
culhl = 'GitSignsChangedeleteCul',
|
||||
},
|
||||
untracked = {
|
||||
hl = 'GitSignsUntracked',
|
||||
text = '┆',
|
||||
numhl = 'GitSignsUntrackedNr',
|
||||
linehl = 'GitSignsUntrackedLn',
|
||||
culhl = 'GitSignsUntrackedCul',
|
||||
},
|
||||
},
|
||||
default_help = [[{
|
||||
|
@ -263,6 +276,7 @@ M.schema = {
|
|||
• `GitSignsAdd` (for normal text signs)
|
||||
• `GitSignsAddNr` (for signs when `config.numhl == true`)
|
||||
• `GitSignsAddLn `(for signs when `config.linehl == true`)
|
||||
• `GitSignsAddCul `(for signs when `config.culhl == true`)
|
||||
|
||||
See |gitsigns-highlight-groups|.
|
||||
]],
|
||||
|
@ -277,30 +291,35 @@ M.schema = {
|
|||
text = '┃',
|
||||
numhl = 'GitSignsStagedAddNr',
|
||||
linehl = 'GitSignsStagedAddLn',
|
||||
culhl = 'GitSignsStagedAddCul',
|
||||
},
|
||||
change = {
|
||||
hl = 'GitSignsStagedChange',
|
||||
text = '┃',
|
||||
numhl = 'GitSignsStagedChangeNr',
|
||||
linehl = 'GitSignsStagedChangeLn',
|
||||
culhl = 'GitSignsStagedChangeCul',
|
||||
},
|
||||
delete = {
|
||||
hl = 'GitSignsStagedDelete',
|
||||
text = '▁',
|
||||
numhl = 'GitSignsStagedDeleteNr',
|
||||
linehl = 'GitSignsStagedDeleteLn',
|
||||
culhl = 'GitSignsStagedDeleteCul',
|
||||
},
|
||||
topdelete = {
|
||||
hl = 'GitSignsStagedTopdelete',
|
||||
text = '▔',
|
||||
numhl = 'GitSignsStagedTopdeleteNr',
|
||||
linehl = 'GitSignsStagedTopdeleteLn',
|
||||
culhl = 'GitSignsStagedTopdeleteCul',
|
||||
},
|
||||
changedelete = {
|
||||
hl = 'GitSignsStagedChangedelete',
|
||||
text = '~',
|
||||
numhl = 'GitSignsStagedChangedeleteNr',
|
||||
linehl = 'GitSignsStagedChangedeleteLn',
|
||||
culhl = 'GitSignsStagedChangedeleteCul',
|
||||
},
|
||||
},
|
||||
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 = {
|
||||
type = 'boolean',
|
||||
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
|
||||
-- {GitSignsDeleteLn = {}},
|
||||
|
||||
|
@ -153,6 +195,11 @@ M.hls = {
|
|||
{ GitSignsStagedDeleteLn = { 'GitSignsDeleteLn', fg_factor = 0.5, hidden = true } },
|
||||
{ GitSignsStagedChangedeleteLn = { 'GitSignsChangedeleteLn', 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 = {
|
||||
|
|
|
@ -65,6 +65,7 @@ function M:add(bufnr, signs)
|
|||
sign_hl_group = hls.hl,
|
||||
number_hl_group = config.numhl and hls.numhl 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
|
||||
|
|
Loading…
Reference in a new issue