mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
fix(highlight): link more treesitter groups by default (#20711)
Problem: Captures used by bundled parsers are not highlighted by default Solution: Add links to default groups A link is added for a capture if * there is a default group of the same name (e.g., `@tag` -> `Tag`) * it's used in a bundled query and doesn't have a reasonable fallback (e.g., `@text.literal`) Also add all linked groups to the treesitter docs.
This commit is contained in:
@@ -371,6 +371,59 @@ instance, to highlight comments differently per language: >
|
|||||||
hi @comment.c guifg=Blue
|
hi @comment.c guifg=Blue
|
||||||
hi @comment.lua @guifg=DarkBlue
|
hi @comment.lua @guifg=DarkBlue
|
||||||
hi link @comment.doc.java String
|
hi link @comment.doc.java String
|
||||||
|
<
|
||||||
|
The following captures are linked by default to standard |group-name|s:
|
||||||
|
>
|
||||||
|
@text.literal Comment
|
||||||
|
@text.reference Identifier
|
||||||
|
@text.title Title
|
||||||
|
@text.uri Underlined
|
||||||
|
@text.underline Underlined
|
||||||
|
@text.todo Todo
|
||||||
|
|
||||||
|
@comment Comment
|
||||||
|
@punctuation Delimiter
|
||||||
|
|
||||||
|
@constant Constant
|
||||||
|
@constant.builtin Special
|
||||||
|
@constant.macro Define
|
||||||
|
@define Define
|
||||||
|
@macro Macro
|
||||||
|
@string String
|
||||||
|
@string.escape SpecialChar
|
||||||
|
@string.special SpecialChar
|
||||||
|
@character Character
|
||||||
|
@character.special SpecialChar
|
||||||
|
@number Number
|
||||||
|
@boolean Boolean
|
||||||
|
@float Float
|
||||||
|
|
||||||
|
@function Function
|
||||||
|
@function.builtin Special
|
||||||
|
@function.macro Macro
|
||||||
|
@parameter Identifier
|
||||||
|
@method Function
|
||||||
|
@field Identifier
|
||||||
|
@property Identifier
|
||||||
|
@constructor Special
|
||||||
|
|
||||||
|
@conditional Conditional
|
||||||
|
@repeat Repeat
|
||||||
|
@label Label
|
||||||
|
@operator Operator
|
||||||
|
@keyword Keyword
|
||||||
|
@exception Exception
|
||||||
|
|
||||||
|
@variable Identifier
|
||||||
|
@type Type
|
||||||
|
@type.definition Typedef
|
||||||
|
@storageclass StorageClass
|
||||||
|
@structure Structure
|
||||||
|
@namespace Identifier
|
||||||
|
@include Include
|
||||||
|
@preproc PreProc
|
||||||
|
@debug Debug
|
||||||
|
@tag Tag
|
||||||
<
|
<
|
||||||
*treesitter-highlight-spell*
|
*treesitter-highlight-spell*
|
||||||
The special `@spell` capture can be used to indicate that a node should be
|
The special `@spell` capture can be used to indicate that a node should be
|
||||||
|
@@ -98,8 +98,6 @@ enum {
|
|||||||
|
|
||||||
// The default highlight groups. These are compiled-in for fast startup and
|
// The default highlight groups. These are compiled-in for fast startup and
|
||||||
// they still work when the runtime files can't be found.
|
// they still work when the runtime files can't be found.
|
||||||
//
|
|
||||||
// When making changes here, also change runtime/colors/default.vim!
|
|
||||||
|
|
||||||
static const char *highlight_init_both[] = {
|
static const char *highlight_init_both[] = {
|
||||||
"Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey",
|
"Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey",
|
||||||
@@ -186,9 +184,13 @@ static const char *highlight_init_both[] = {
|
|||||||
"default link DiagnosticSignInfo DiagnosticInfo",
|
"default link DiagnosticSignInfo DiagnosticInfo",
|
||||||
"default link DiagnosticSignHint DiagnosticHint",
|
"default link DiagnosticSignHint DiagnosticHint",
|
||||||
|
|
||||||
|
// Text
|
||||||
|
"default link @text.literal Comment",
|
||||||
|
"default link @text.reference Identifier",
|
||||||
|
"default link @text.title Title",
|
||||||
|
"default link @text.uri Underlined",
|
||||||
"default link @text.underline Underlined",
|
"default link @text.underline Underlined",
|
||||||
"default link @todo Todo",
|
"default link @text.todo Todo",
|
||||||
"default link @debug Debug",
|
|
||||||
|
|
||||||
// Miscs
|
// Miscs
|
||||||
"default link @comment Comment",
|
"default link @comment Comment",
|
||||||
@@ -202,6 +204,7 @@ static const char *highlight_init_both[] = {
|
|||||||
"default link @macro Macro",
|
"default link @macro Macro",
|
||||||
"default link @string String",
|
"default link @string String",
|
||||||
"default link @string.escape SpecialChar",
|
"default link @string.escape SpecialChar",
|
||||||
|
"default link @string.special SpecialChar",
|
||||||
"default link @character Character",
|
"default link @character Character",
|
||||||
"default link @character.special SpecialChar",
|
"default link @character.special SpecialChar",
|
||||||
"default link @number Number",
|
"default link @number Number",
|
||||||
@@ -226,12 +229,16 @@ static const char *highlight_init_both[] = {
|
|||||||
"default link @keyword Keyword",
|
"default link @keyword Keyword",
|
||||||
"default link @exception Exception",
|
"default link @exception Exception",
|
||||||
|
|
||||||
|
"default link @variable Identifier",
|
||||||
"default link @type Type",
|
"default link @type Type",
|
||||||
"default link @type.definition Typedef",
|
"default link @type.definition Typedef",
|
||||||
"default link @storageclass StorageClass",
|
"default link @storageclass StorageClass",
|
||||||
"default link @structure Structure",
|
"default link @structure Structure",
|
||||||
|
"default link @namespace Identifier",
|
||||||
"default link @include Include",
|
"default link @include Include",
|
||||||
"default link @preproc PreProc",
|
"default link @preproc PreProc",
|
||||||
|
"default link @debug Debug",
|
||||||
|
"default link @tag Tag",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user