aboutsummaryrefslogtreecommitdiff
path: root/lua/prismite/groups/plugins/treesitter.lua
blob: 0302c53e5afad93b691af8c3bd261ecaaeaf55da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
local colors = require "prismite.palette"

return {
    -- various variable names
    ["@variable"] = { link = "Identifier" },
    -- built-in variable names (e.g. `this`)
    ["@variable.builtin"] = { fg = colors.pink, bold = true },
    -- parameters of a function
    ["@variable.parameter"] = { link = "@variable" },
    -- special parameters (e.g. `_`, `it`)
    ["@variable.parameter.builtin"] = { link = "@variable.builtin" },
    -- object and struct fields
    ["@variable.member"] = { fg = colors.fg },

    -- constant identifiers
    ["@constant"] = { link = "Constant" },
    -- built-in constant values
    ["@constant.builtin"] = { link = "@constant" },
    -- constants defined by the preprocessor
    ["@constant.macro"] = { link = "@constant" },

    -- modules or namespaces
    ["@module"] = { italic = true },
    -- built-in modules or namespaces
    ["@module.builtin"] = { link = "@module" },
    -- GOTO and other labels (e.g. `label:` in C), including heredoc labels
    ["@label"] = { link = "Todo" },

    -- string literals
    ["@string"] = { link = "String" },
    -- string documenting code (e.g. Python docstrings
    ["@string.documentation"] = { link = "@comment" },
    -- regular expressions
    ["@string.regexp"] = { link = "@constant" },
    -- escape sequences
    ["@string.escape"] = { fg = colors.cyan },
    -- other special strings (e.g. dates)
    ["@string.special"] = { link = "@string" },
    -- symbols or atoms
    ["@string.special.symbol"] = { link = "@string" },
    -- URIs (e.g. hyperlinks)
    ["@string.special.url"] = { underline = true },
    -- filenames
    ["@string.special.path"] = { link = "@string" },

    -- character literals
    ["@character"] = { link = "@constant" },
    -- special characters (e.g. wildcards)
    ["@character.special"] = { link = "String" },

    -- boolean literals
    ["@boolean"] = { link = "@constant" },
    -- numeric literals
    ["@number"] = { link = "@constant" },
    -- floating-point number literals
    ["@number.float"] = { link = "@number" },

    -- type or class definitions and annotations
    ["@type"] = { link = "Type" },
    -- built-in types
    ["@type.builtin"] = { link = "@type" },
    -- identifiers in type definitions (e.g. `typedef <type> <identifier>` in C)
    ["@type.definition"] = { link = "@type" },

    -- attribute annotations (e.g. Python decorators, Rust lifetimes)
    ["@attribute"] = { link = "Function" },
    -- builtin annotations (e.g. `@property` in Python)
    ["@attribute.builtin"] = { link = "@attribute" },
    -- the key in key/value pairs
    ["@property"] = { fg = colors.fg },

    -- function definitions
    ["@function"] = { link = "Function" },
    -- built-in functions
    ["@function.builtin"] = { link = "@function" },
    -- function calls
    ["@function.call"] = { link = "@function" },
    -- preprocessor macros
    ["@function.macro"] = { link = "@constant.macro" },

    -- method definitions
    ["@function.method"] = { link = "@function" },
    -- method calls
    ["@function.method.call"] = { link = "@function.method" },

    -- constructor calls and definitions
    ["@constructor"] = { link = "@function" },
    -- this is overriden because for some reason the {} in table inits
    -- are parsed as constructors, which ig makes sense
    ["@constructor.lua"] = { fg = colors.fg },
    -- symbolic operators (e.g. `+` / `*`)
    ["@operator"] = { fg = colors.fg },

    -- keywords not fitting into specific categories
    ["@keyword"] = { link = "Keyword" },
    -- keywords related to coroutines (e.g. `go` in Go, `async/await` in Python)
    ["@keyword.coroutine"] = { link = "@keyword" },
    -- keywords that define a function (e.g. `func` in Go, `def` in Python)
    ["@keyword.function"] = { link = "@keyword" },
    -- operators that are English words (e.g. `and` / `or`)
    ["@keyword.operator"] = { link = "@keyword" },
    -- keywords for including or exporting modules (e.g. `import` / `from` in Python)
    ["@keyword.import"] = { link = "@keyword" },
    -- keywords describing namespaces and composite types (e.g. `struct`, `enum`)
    ["@keyword.type"] = { link = "@keyword" },
    -- keywords modifying other constructs (e.g. `const`, `static`, `public`)
    ["@keyword.modifier"] = { link = "@keyword" },
    -- keywords related to loops (e.g. `for` / `while`)
    ["@keyword.repeat"] = { link = "@keyword" },
    -- keywords like `return` and `yield`
    ["@keyword.return"] = { link = "@keyword" },
    -- keywords related to debugging
    ["@keyword.debug"] = { link = "@keyword" },
    -- keywords related to exceptions (e.g. `throw` / `catch`)
    ["@keyword.exception"] = { link = "@keyword" },

    -- keywords related to conditionals (e.g. `if` / `else`)
    ["@keyword.conditional"] = { link = "@keyword" },
    -- ternary operator (e.g. `?` / `:`)
    ["@keyword.conditional.ternary"] = { link = "@operator" },

    -- various preprocessor directives & shebangs
    ["@keyword.directive"] = { link = "@keyword" },
    -- preprocessor definition directives
    ["@keyword.directive.define"] = { link = "@keyword" },

    -- delimiters (e.g. `;` / `.` / `,`)
    ["@punctuation"] = { fg = colors.fg },
    -- brackets (e.g. `()` / `{}` / `[]`)
    ["@punctuation.special"] = { fg = colors.cyan },
    -- special symbols (e.g. `{}` in string interpolation)

    -- line and block comments
    ["@comment"] = { link = "Comment" },
    -- comments documenting code
    ["@comment.documentation"] = { link = "@comment" },

    ["@comment.error"] = { sp = colors.red, underline = true },
    ["@comment.warning"] = { sp = colors.orange, underline = true },
    ["@comment.todo"] = { link = "Todo" },
    ["@comment.note"] = { sp = colors.blue, underline = true },

    ["@markup.strong"] = { bold = true },
    ["@markup.italic"] = { italic = true },
    ["@markup.strikethrough"] = { strikethrough = true },
    ["@markup.underline"] = { underline = true },

    ["@markup.heading"] = { fg = colors.blue },

    ["@markup.link"] = { fg = colors.cyan },
    ["@markup.link.label"] = { bold = true },
    ["@markup.link.url"] = { underline = true },

    ["@diff.plus"] = { link = "Added" },
    ["@diff.delta"] = { link = "Changed" },
    ["@diff.minus"] = { link = "Removed" },

    ["@tag"] = { link = "htmlTag" },
    ["@tag.builtin"] = { link = "@tag" },
    ["@tag.attribute"] = { link = "@property" },
    ["@tag.delimeter"] = { link = "@tag" },

    ["@none"] = { link = "Normal" },
}