Skip to content

Commit b815bfd

Browse files
committed
fix: remove redundant highlight-group links
Comment-out several redundant hl-group links in: - lua/github-theme/group/syntax.lua - lua/github-theme/group/modules/treesitter.lua These are redundant because they specify links which are identical to Neovim defaults (e.g. `@string --> String`, `@function.call --> @function`, etc.). They are mimicking default links that Neovim already ships and starts-up with. Colorschemes may break Neovim's default links arbitrarily, and `:hi clear` restores them. Since we don't know if/which default links have been broken by the previous colorscheme when loading ours, we should restore these default links—either with `:hi clear`, or manually—before ours is loaded. This already appears to be happening within compiled colorschemes (i.e. `hi clear` gets embedded within them). Furthermore, colorscheme compilation happens automatically by default and cannot be disabled.
1 parent f09a14e commit b815bfd

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

lua/github-theme/group/modules/treesitter.lua

+26-26
Original file line numberDiff line numberDiff line change
@@ -15,59 +15,59 @@ If you want to stay on nvim 0.7, disable the module, or track on 'v0.0.x' branch
1515
-- stylua: ignore
1616
return {
1717
-- Misc
18-
['@comment'] = { link = 'Comment' },
19-
['@error'] = { link = 'Error' },
20-
['@preproc'] = { link = 'PreProc' }, -- various preprocessor directives & shebangs
21-
['@define'] = { link = 'Define' }, -- preprocessor definition directives
22-
['@operator'] = { link = 'Operator' }, -- For any operator: +, but also -> and * in C.
18+
-- ['@comment'] = { link = 'Comment' },
19+
['@error'] = { link = 'Error' },
20+
-- ['@preproc'] = { link = 'PreProc' }, -- Various preprocessor directives & shebangs
21+
-- ['@define'] = { link = 'Define' }, -- Preprocessor definition directives
22+
-- ['@operator'] = { link = 'Operator' }, -- For any operator: +, but also -> and * in C
2323

2424
-- Punctuation
2525
['@punctuation.delimiter'] = { fg = syn.bracket }, -- For delimiters ie: .
2626
['@punctuation.bracket'] = { fg = syn.bracket }, -- For brackets and parenthesis.
2727
['@punctuation.special'] = { fg = syn.builtin2, style = stl.operators }, -- For special punctutation that does not fall in the catagories before.
2828

2929
-- Literals
30-
['@string'] = { link = 'String' }, -- For strings.
30+
-- ['@string'] = { link = 'String' }, -- For strings.
3131
['@string.regex'] = { fg = syn.regex, style = stl.strings }, -- Regular expression literals.
3232
['@string.escape'] = { fg = syn.regex, style = 'bold' }, -- Escape characters within a string: `\n`, `\t`, etc.
3333
['@string.special'] = { link = 'Special' }, -- other special strings (e.g. dates)
3434

35-
['@character'] = { link = 'Character' }, -- character literals
36-
['@character.special'] = { link = 'SpecialChar' }, -- special characters (e.g. wildcards)
35+
-- ['@character'] = { link = 'Character' }, -- character literals
36+
-- ['@character.special'] = { link = 'SpecialChar' }, -- special characters (e.g. wildcards)
3737

38-
['@boolean'] = { link = 'Boolean' }, -- For booleans.
39-
['@number'] = { link = 'Number' }, -- For all numbers
40-
['@float'] = { link = 'Number' }, -- For floats.
38+
-- ['@boolean'] = { link = 'Boolean' }, -- For booleans.
39+
-- ['@number'] = { link = 'Number' }, -- For all numbers
40+
-- ['@float'] = { link = 'Float' }, -- For floats.
4141

4242
-- Functions
43-
['@function'] = { link = 'Function' }, -- For function (calls and definitions).
43+
-- ['@function'] = { link = 'Function' }, -- For function (calls and definitions).
4444
['@function.builtin'] = { fg = syn.builtin2, style = stl.functions }, -- For builtin functions: table.insert in Lua.
45-
['@function.call'] = { link = '@function' }, -- function calls
45+
-- ['@function.call'] = { link = '@function' }, -- function calls
4646
['@function.macro'] = { fg = syn.builtin0, style = stl.functions }, -- For macro defined functions (calls and definitions): each macro_rules in RusC.
47-
['@method'] = { link = '@function'}, -- For method calls and definitions.
47+
-- ['@method'] = { link = '@function'}, -- For method definitions/declarations.
4848

49-
['@method.call'] = { link = '@method' }, -- method calls
49+
-- ['@method.call'] = { link = '@method' }, -- method calls
5050

5151
['@constructor'] = { fg = syn.ident }, -- For constructor calls and definitions: = { } in Lua, and Java constructors.
5252
['@parameter'] = { fg = syn.param, stl.variables }, -- For parameters of a function.
5353

5454
-- Keywords
55-
['@keyword'] = { link = 'Keyword' }, -- For keywords that don't fall in previous categories.
55+
-- ['@keyword'] = { link = 'Keyword' }, -- For keywords that don't fall in previous categories.
5656
['@keyword.function'] = { fg = syn.keyword, style = stl.functions }, -- Keywords used to define a function: `function` in Lua, `def` and `lambda` in Python.
5757
['@keyword.operator'] = { fg = syn.operator, style = stl.operators }, -- For new keyword operator
5858
['@keyword.return'] = { fg = syn.builtin0, style = stl.keywords },
5959

60-
['@conditional'] = { link = 'Conditional' }, -- For keywords related to conditionnals.
61-
['@repeat'] = { link = 'Repeat' }, -- For keywords related to loops.
62-
['@label'] = { link = 'Label' }, -- For labels: label: in C and :label: in Lua.
63-
['@include'] = { link = 'Include' }, -- For includes: #include in C, use or extern crate in Rust, or require in Lua.
60+
-- ['@conditional'] = { link = 'Conditional' }, -- For keywords related to conditionals.
61+
-- ['@repeat'] = { link = 'Repeat' }, -- For keywords related to loops.
62+
-- ['@label'] = { link = 'Label' }, -- For labels: label: in C and :label: in Lua.
63+
-- ['@include'] = { link = 'Include' }, -- For includes: #include in C, use or extern crate in Rust, or require in Lua.
6464
['@exception'] = { fg = syn.builtin0, style = stl.keywords }, -- Exception related keywords: `try`, `except`, `finally` in Python.
6565

6666
-- Types
67-
['@type'] = { link = 'Type' }, -- For types.
67+
-- ['@type'] = { link = 'Type' }, -- For types.
6868
['@type.builtin'] = { fg = syn.builtin1, style = stl.types }, -- For builtin types.
69-
['@type.definition'] = { link = '@type' }, -- type definitions (e.g. `typedef` in C)
70-
['@type.qualifier'] = { link = '@type' }, -- type qualifiers (e.g. `const`)
69+
-- ['@type.definition'] = { link = '@type' }, -- type definitions (e.g. `typedef` in C)
70+
-- ['@type.qualifier'] = { link = '@type' }, -- type qualifiers (e.g. `const`)
7171

7272
['@storageclass'] = { link = 'StorageClass' }, -- visibility/life-time/etc. modifiers (e.g. `static`)
7373
['@attribute'] = { link = 'Constant' }, -- attribute annotations (e.g. Python decorators)
@@ -78,7 +78,7 @@ If you want to stay on nvim 0.7, disable the module, or track on 'v0.0.x' branch
7878
['@variable'] = { fg = syn.variable, style = stl.variables }, -- Any variable name that does not have another highlighC.
7979
['@variable.builtin'] = { fg = syn.builtin0, style = stl.variables }, -- Variable names that are defined by the languages, like this or self.
8080

81-
['@constant'] = { link = 'Constant' }, -- For constants
81+
-- ['@constant'] = { link = 'Constant' }, -- For constants
8282
['@constant.builtin'] = { fg = syn.builtin2, style = stl.keywords }, -- For constant that are built in the language: nil in Lua.
8383
['@constant.macro'] = { link = 'Macro' }, -- For constants that are defined by macros: NULL in C.
8484

@@ -89,9 +89,9 @@ If you want to stay on nvim 0.7, disable the module, or track on 'v0.0.x' branch
8989
['@text'] = { fg = spec.fg1 }, -- For strings considerated text in a markup language.
9090
['@text.strong'] = { fg = spec.fg1, style = 'bold' }, -- bold
9191
['@text.emphasis'] = { fg = spec.fg1, style = 'italic' }, -- italic
92-
['@text.underline'] = { link = 'Underlined' }, -- underlined text
92+
-- ['@text.underline'] = { link = 'Underlined' }, -- underlined text
9393
['@text.strike'] = { fg = spec.fg1, style = 'strikethrough' }, -- strikethrough text
94-
['@text.title'] = { link = 'Title'}, -- titles like: # Example
94+
-- ['@text.title'] = { link = 'Title'}, -- titles like: # Example
9595
['@text.literal'] = { fg = syn.ident, style = 'italic' }, -- used for inline code in markdown and for doc in python (''')
9696
['@text.uri'] = { fg = syn.const, style = 'italic,underline' }, -- urls, links and emails
9797
['@text.math'] = { fg = syn.func }, -- math environments (e.g. `$ ... $` in LaTeX)

lua/github-theme/group/syntax.lua

+10-10
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ function M.get(spec, config)
3535
PreCondit = { link = 'PreProc' }, -- preprocessor #if, #else, #endif, etc.
3636

3737
Type = { fg = syn.type, style = stl.types }, -- (preferred) int, long, char, etc.
38-
StorageClass = { link = 'Type' }, -- static, register, volatile, etc.
39-
Structure = { link = 'Type' }, -- struct, union, enum, etc.
40-
Typedef = { link = 'Type' }, -- A typedef
41-
42-
Special = { fg = syn.ident }, -- (preferred) any special symbol
43-
SpecialChar = { link = 'Special' }, -- special character in a constant
44-
Tag = { link = 'Special' }, -- you can use CTRL-] on this
45-
Delimiter = { link = 'Special' }, -- character that needs attention
46-
SpecialComment = { link = 'Special' }, -- special things inside a comment
47-
Debug = { link = 'Special' }, -- debugging statements
38+
-- StorageClass = { link = 'Type' }, -- static, register, volatile, etc.
39+
-- Structure = { link = 'Type' }, -- struct, union, enum, etc.
40+
-- Typedef = { link = 'Type' }, -- A typedef
41+
42+
-- Special = { fg = syn.ident }, -- (preferred) any special symbol
43+
-- SpecialChar = { link = 'Special' }, -- special character in a constant
44+
-- Tag = { link = 'Special' }, -- you can use CTRL-] on this
45+
-- Delimiter = { link = 'Special' }, -- character that needs attention
46+
-- SpecialComment = { link = 'Special' }, -- special things inside a comment
47+
-- Debug = { link = 'Special' }, -- debugging statements
4848

4949
Underlined = { style = 'underline' }, -- (preferred) text that stands out, HTML links
5050
Bold = { style = 'bold' },

0 commit comments

Comments
 (0)