feat(colorscheme): update treesitter groups

Problem: Currently default color scheme defines most of treesitter
  highlight groups. This might be an issue for users defining their own
  color scheme as it breaks the "fallback property" for some of groups.

Solution: Define less default treesitter groups; just enough for default
  color scheme to be useful. That is:
    - All first level groups (`@character`, `@string`, etc.).
    - All `@xxx.builtin` groups as a most common subgroup.
    - Some special cases (links/URLs, `@diff.xxx`, etc.).
This commit is contained in:
Evgeni Chasnovski 2024-01-25 11:33:24 +02:00 committed by Christian Clason
parent d4bd6b1eaa
commit 1e0996b572
2 changed files with 46 additions and 68 deletions

View File

@ -422,8 +422,9 @@ instance, to highlight comments differently per language: >vim
hi @comment.lua guifg=DarkBlue
hi link @comment.documentation.java String
<
The following captures are linked by default to standard |group-name|s (use
|:Inspect| on a group to see the current link):
The following is a list of standard captures used in queries for Nvim,
highlighted according to the current colorscheme (use |:Inspect| on one to see
the exact definition):
@variable various variable names
@variable.builtin built-in variable names (e.g. `this` / `self`)

View File

@ -224,21 +224,18 @@ static const char *highlight_init_both[] = {
// Treesitter standard groups
"default link @variable.builtin Special",
"default link @variable.parameter Identifier",
"default link @variable.member Identifier",
"default link @constant Constant",
"default link @constant.builtin Special",
"default link @constant.macro Define",
"default link @module Structure",
"default link @module.builtin Special",
"default link @label Label",
"default link @string String",
"default link @string.regexp SpecialChar",
"default link @string.escape SpecialChar",
"default link @string.regexp @string.special",
"default link @string.escape @string.special",
"default link @string.special SpecialChar",
"default link @string.special.symbol Constant",
"default link @string.special.url Underlined",
"default link @character Character",
@ -250,35 +247,19 @@ static const char *highlight_init_both[] = {
"default link @type Type",
"default link @type.builtin Special",
"default link @type.definition Typedef",
"default link @type.qualifier StorageClass",
"default link @attribute Macro",
"default link @property Identifier",
"default link @function Function",
"default link @function.builtin Special",
"default link @function.macro Macro",
"default link @constructor Special",
"default link @operator Operator",
"default link @keyword Keyword",
"default link @keyword.function Statement",
"default link @keyword.operator Operator",
"default link @keyword.import Include",
"default link @keyword.storage StorageClass",
"default link @keyword.repeat Repeat",
"default link @keyword.debug Debug",
"default link @keyword.exception Exception",
"default link @keyword.conditional Conditional",
"default link @keyword.directive Preproc",
"default link @keyword.directive.define Define",
"default link @punctuation.delimiter Delimiter",
"default link @punctuation.bracket Delimiter",
"default link @punctuation Delimiter", // fallback for subgroups; never used itself
"default link @punctuation.special Special",
"default link @comment Comment",
@ -290,22 +271,18 @@ static const char *highlight_init_both[] = {
"@markup.strong gui=bold cterm=bold",
"@markup.italic gui=italic cterm=italic",
"@markup.strikethrough gui=strikethrough, cterm=strikethrough",
"@markup.underline gui=underline, cterm=underline",
"@markup.strikethrough gui=strikethrough cterm=strikethrough",
"@markup.underline gui=underline cterm=underline",
"default link @markup Special", // fallback for subgroups; never used itself
"default link @markup.heading Title",
"default link @markup.environment Structure",
"default link @markup.link Underlined",
"default link @markup.list.checked DiagnosticOk",
"default link @markup.list.unchecked DiagnosticWarn",
"default link @diff.plus Added",
"default link @diff.minus Removed",
"default link @diff.delta Changed",
"default link @tag Tag",
"default link @tag.delimiter Delimiter",
// LSP semantic tokens
"default link @lsp.type.class @type",