Skip to content

Commit 90ea2ed

Browse files
mehalterA-Lamia
andauthored
feat(treesitter): major syntax theme rework for better readability (#24)
feat(treesitter)!: major syntax theme rework for better readability Large rework on treesitter group with slight modifications to syntax group and LSP module for much better readability. Still in early stages may be some issues to fix later but mostly done. Co-authored-by: A-Lamia <git@lamia.io>
1 parent d47d183 commit 90ea2ed

File tree

3 files changed

+160
-44
lines changed

3 files changed

+160
-44
lines changed

lua/astrotheme/groups/lsp.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ local function callback()
2727
["@lsp.type.builtinType"] = { fg = C.yellow, bg = C.none },
2828
["@lsp.type.keyword"] = { link = "Keyword" },
2929
["@lsp.type.operator"] = { link = "Operator" },
30+
["@lsp.type.parameter"] = { link = "@parameter" },
31+
["@lsp.type.property"] = { link = "@property" },
32+
["@lsp.type.variable"] = { link = "@lsp.type.variable" },
3033
["@lsp.typemod.enumMember.defaultLibrary"] = { fg = C.cyan, bg = C.none },
3134
["@lsp.typemod.function.defaultLibrary"] = { fg = C.cyan, bg = C.none },
3235
["@lsp.typemod.function.global"] = { fg = C.cyan, bg = C.none },

lua/astrotheme/groups/plugins/nvim-treesitter.lua

Lines changed: 154 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,178 @@
11
local function callback()
22
return {
3+
4+
-- misc
5+
["@comment"] = { link = "Comment" },
6+
["@define"] = { link = "Define" },
7+
["@error"] = { link = "Error" },
8+
["@operator"] = { link = "Operator" },
9+
["@preproc"] = { link = "PreProc" },
10+
11+
-- data types
12+
["@boolean"] = { link = "Boolean" },
13+
["@number"] = { link = "Number" },
14+
["@float"] = { link = "Float" },
15+
["@string"] = { link = "String" },
16+
["@string.escape"] = { fg = C.red },
17+
["@string.regex"] = { link = "String" },
18+
["@string.special"] = { link = "String" },
19+
["@character"] = { link = "Character" },
20+
["@character.special"] = { link = "SpecialChar" },
21+
322
["@annotation"] = { fg = C.yellow },
423
["@attribute"] = { fg = C.red },
5-
["@boolean"] = { fg = C.orange },
6-
["@character"] = { fg = C.green },
7-
["@conditional"] = { fg = C.purple },
8-
["@constant"] = { fg = C.yellow },
9-
["@constant.builtin"] = { fg = C.orange },
10-
["@constant.macro"] = { fg = C.red },
11-
["@constant.rust"] = { fg = C.cyan },
24+
25+
-- function
1226
["@constructor"] = { fg = C.yellow },
13-
["@error"] = { fg = C.red },
14-
["@exception"] = { fg = C.purple },
15-
["@field"] = { fg = C.red },
16-
["@float"] = { fg = C.orange },
17-
["@function"] = { fg = C.blue },
18-
["@function.builtin"] = { fg = C.blue },
27+
["@function"] = { link = "Function" },
28+
["@function.builtin"] = { fg = C.cyan },
29+
["@function.call"] = { link = "@function" },
1930
["@function.macro"] = { fg = C.yellow },
20-
["@function.macro.rust"] = { fg = C.orange },
21-
["@include"] = { fg = C.purple },
31+
["@method"] = { fg = C.cyan },
32+
["@method.call"] = { link = "@method" },
33+
34+
-- identifiers
35+
["@constant"] = { link = "Constant" },
36+
["@constant.builtin"] = { fg = C.orange },
37+
["@constant.macro"] = { fg = C.red },
38+
39+
["@namespace"] = { link = "Keyword" },
40+
["@symbol"] = { link = "Special" },
41+
42+
["@variable"] = { link = "Identifier" },
43+
["@variable.builtin"] = { fg = C.red },
44+
45+
["@property"] = { link = "@variable.builtin" },
46+
47+
-- keyword
48+
["@conditional"] = { link = "Conditional" },
49+
["@exception"] = { link = "Exception" },
50+
["@include"] = { link = "Include" },
51+
2252
["@keyword"] = { link = "Keyword" },
53+
["@keyword.export"] = { link = "Keyword" },
2354
["@keyword.function"] = { link = "Keyword" },
24-
["@keyword.function.rust"] = { fg = C.orange },
2555
["@keyword.operator"] = { link = "Keyword" },
26-
["@label"] = { fg = C.blue },
27-
["@literal.markdown"] = { fg = C.green },
28-
["@method"] = { fg = C.blue },
29-
["@namespace"] = { link = "Keyword" },
30-
["@namespace.rust"] = { fg = C.yellow },
31-
["@none.markdown"] = { fg = C.text },
32-
["@number"] = { fg = C.orange },
33-
["@parameter"] = { fg = C.red },
56+
["@keyword.return"] = { link = "Keyword" },
57+
58+
["@label"] = { link = "Label" },
59+
["@parameter"] = { fg = C.orange },
3460
["@parameter.reference"] = { fg = C.cyan },
35-
["@property"] = { fg = C.yellow },
61+
62+
["@repeat"] = { link = "Repeat" },
63+
64+
-- punctuation
3665
["@punctuation.bracket"] = { fg = C.text },
3766
["@punctuation.delimiter"] = { fg = C.text },
38-
["@punctuation.delimiter.markdown"] = { fg = C.text },
3967
["@punctuation.special"] = { fg = C.text },
40-
["@punctuation.special.markdown"] = { fg = C.red },
41-
["@repeat"] = { fg = C.purple },
42-
["@string"] = { fg = C.green },
43-
["@string.escape"] = { fg = C.red },
44-
["@string.regex"] = { fg = C.green },
68+
69+
-- tag
4570
["@tag"] = { fg = C.red },
4671
["@tag.attribute"] = { fg = C.cyan },
4772
["@tag.delimiter"] = { fg = C.text },
73+
74+
-- semantic tokens
75+
["@class"] = { fg = C.blue },
76+
["@decorator"] = { fg = C.orange },
77+
["@enum"] = { fg = C.cyan },
78+
["@enumMember"] = { fg = C.orange },
79+
["@event"] = { fg = C.orange },
80+
["@interface"] = { fg = C.orange },
81+
["@modifier"] = { fg = C.orange },
82+
["@regexp"] = { fg = C.cyan },
83+
["@struct"] = { fg = C.blue },
84+
["@typeParameter"] = { fg = C.yellow },
85+
86+
-- text
4887
["@text"] = { fg = C.text },
4988
["@text.emphasis"] = { fg = C.purple, italic = true },
89+
["@text.environment"] = { fg = C.orange },
90+
["@text.environment.name"] = { fg = C.blue },
5091
["@text.literal"] = { fg = C.text },
51-
["@text.reference"] = { fg = C.yellow },
92+
["@text.math"] = { fg = C.blue },
93+
["@text.reference"] = { fg = C.yellow, bold = true },
5294
["@text.strong"] = { fg = C.blue, bold = true },
53-
["@text.title"] = { fg = C.text },
54-
["@text.underline"] = { fg = C.text },
55-
["@text.uri"] = { fg = C.green },
56-
["@title.markdown"] = { fg = C.red },
57-
["@type"] = { fg = C.blue },
58-
["@type.builtin"] = { fg = C.blue },
59-
["@type.qualifier.typescript"] = { link = "Keyword" },
95+
["@text.strike"] = { fg = C.green, strikethrough = true },
96+
["@text.title"] = { fg = C.text, bold = true },
97+
["@text.underline"] = { link = "Underline" },
98+
["@text.uri"] = { fg = C.green, italic = true, underline = true },
99+
100+
["@text.todo"] = { fg = C.base, bg = C.yellow },
101+
["@text.todo.checked"] = { fg = C.green },
102+
["@text.todo.danger"] = { fg = C.base, bg = C.red },
103+
["@text.todo.note"] = { fg = C.base, bg = C.blue },
104+
["@text.todo.unchecked"] = { fg = C.overlay1 },
105+
["@text.todo.warning"] = { fg = C.base, bg = C.yellow },
106+
107+
["@text.diff.add"] = { link = "DiffAdded" },
108+
["@text.diff.delete"] = { link = "DiffDelete" },
109+
110+
-- type
111+
["@field"] = { fg = C.red },
112+
["@storageclass"] = { link = "StorageClass" },
113+
114+
["@type"] = { link = "Type" },
115+
["@type.builtin"] = { link = "@type" },
116+
["@type.definition"] = { link = "@type" },
117+
["@type.qualifier"] = { link = "@type" },
118+
119+
-----------------------
120+
-- Language Specific --
121+
-----------------------
122+
123+
-- cpp
124+
["@property.cpp"] = { fg = C.orange },
125+
126+
-- css
127+
["@number.css"] = { fg = C.cyan },
128+
["@property.css"] = { fg = C.orange },
129+
["@property.class.css"] = { fg = C.yellow },
130+
["@property.id.css"] = { fg = C.blue },
131+
["@string.plain.css"] = { fg = C.green },
132+
["@type.tag.css"] = { fg = C.purple },
133+
["@type.css"] = { fg = C.orange },
134+
135+
-- json
136+
["@label.json"] = { fg = C.blue },
137+
138+
-- lua
139+
["@constructor.lua"] = { fg = C.orange },
140+
["@variable.lua"] = { link = "@variable" },
141+
142+
-- markdown
143+
["@literal.markdown"] = { fg = C.green },
144+
["@none.markdown"] = { fg = C.text },
145+
["@punctuation.delimiter.markdown"] = { fg = C.text },
146+
["@punctuation.special.markdown"] = { fg = C.red },
147+
["@title.markdown"] = { fg = C.red, bold = true },
148+
149+
-- PHP
150+
["@type.qualifier.php"] = { link = "Keyword" },
151+
["@method.php"] = { link = "Function" },
152+
["@method.call.php"] = { link = "Function" },
153+
154+
-- Ruby
155+
["@symbol.ruby"] = { fg = C.orange },
156+
157+
-- rust
158+
["@constant.rust"] = { fg = C.cyan },
159+
["@function.macro.rust"] = { fg = C.orange },
160+
["@keyword.function.rust"] = { fg = C.orange },
161+
["@namespace.rust"] = { fg = C.yellow },
60162
["@type.rust"] = { fg = C.yellow },
61-
["@variable"] = { fg = C.red },
62-
["@variable.builtin"] = { fg = C.yellow },
163+
164+
-- toml
165+
["@property.toml"] = { fg = C.blue },
166+
167+
-- typescript
168+
["@type.qualifier.typescript"] = { link = "Keyword" },
169+
170+
-- TSX (Typescript React)
171+
["@constructor.tsx"] = { fg = C.lavender },
172+
["@tag.attribute.tsx"] = { fg = C.purple, italic = true },
173+
174+
-- yaml
175+
["@field.yaml"] = { fg = C.blue },
63176
}
64177
end
65178

lua/astrotheme/groups/syntax.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ local function callback()
2020
Boolean = { fg = C.blue, bg = C.none }, -- a boolean constant: TRUE, false
2121
Float = { fg = C.yellow, bg = C.none }, -- a floating point constant: 2.3e10
2222
-- Identifier
23-
Identifier = { fg = C.red, bg = C.none }, -- any variable name
23+
Identifier = { fg = C.text, bg = C.none }, -- any variable name
2424
Function = { fg = C.blue, bg = C.none }, -- function name (also: methods for classes)
2525
-- Statement
2626
Statement = { fg = C.purple, bg = C.none }, -- any statement
27-
Conditional = { fg = C.light_purple, bg = C.none }, -- if, then, else, endif, switch, etc.
27+
Conditional = { fg = C.purple, bg = C.none }, -- if, then, else, endif, switch, etc.
2828
Repeat = { fg = C.purple, bg = C.none }, -- for, do, while, etc.
2929
Label = { fg = C.blue, bg = C.none }, -- case, default, etc.
3030
Operator = { fg = C.text, bg = C.none }, -- "sizeof", "+", "*", etc.
@@ -49,7 +49,7 @@ local function callback()
4949
SpecialComment = { fg = C.subtext0, bg = C.none }, -- special things inside a comment
5050
Debug = { fg = C.blue, bg = C.none }, -- debugging statements
5151
-- Underlined
52-
Underlined = { fg = C.cyan, bg = C.none }, -- text that stands out, HTML links
52+
Underlined = { fg = C.cyan, bg = C.none, underline = true }, -- text that stands out, HTML links
5353
-- Ignore
5454
Ignore = { fg = C.none, bg = C.none }, -- left blank, hidden |hl-Ignore|
5555
-- Error

0 commit comments

Comments
 (0)