tangled
alpha
login
or
join now
algmyr.se
/
vim-wombat-lua
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
Split out treesitter groups.
algmyr.se
9 months ago
583c307d
2255b105
+133
-127
2 changed files
expand all
collapse all
unified
split
lua
wombat_lua
groups
treesitter.lua
init.lua
+130
lua/wombat_lua/groups/treesitter.lua
···
1
1
+
local M = {}
2
2
+
3
3
+
function M.build(Group, c, g, s)
4
4
+
Group.new("UnknownThing", c.norm, c.unknown)
5
5
+
6
6
+
-- Structured following:
7
7
+
-- https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#highlights
8
8
+
9
9
+
-- Misc {{{1
10
10
+
-- @errors is TS errors. Wildly noisy if you enable it.
11
11
+
-- Group.link("@error", g.ErrorMsg) -- syntax/parser errors
12
12
+
Group.link("@comment", g.Comment) -- line and block comments
13
13
+
-- Group.link("@none", g.UnknownThing) -- completely disable the highlight
14
14
+
-- Group.link("@preproc", g.UnknownThing) -- various preprocessor directives & shebangs
15
15
+
-- Group.link("@define", g.UnknownThing) -- preprocessor definition directives
16
16
+
Group.link("@operator", g.Operator) -- symbolic operators (e.g. `+` / `*`)
17
17
+
18
18
+
-- Punctuation {{{1
19
19
+
Group.link("@punctuation.delimiter", g.Special) -- delimiters (e.g. `;` / `.` / `,`)
20
20
+
Group.link("@punctuation.bracket", g.Special) -- brackets (e.g. `()` / `{}` / `[]`)
21
21
+
Group.link("@punctuation.special", g.Special) -- special symbols (e.g. `{}` in string interpolation)
22
22
+
23
23
+
-- Literals {{{1
24
24
+
Group.link("@string", g.String) -- string literals
25
25
+
Group.link("@string.regex", g.String) -- regular expressions
26
26
+
Group.link("@string.escape", g.StringEscape) -- escape sequences
27
27
+
Group.link("@string.special", g.String) -- other special strings (e.g. dates)
28
28
+
29
29
+
Group.link("@character", g.Character) -- character literals
30
30
+
Group.link("@character.special", g.Character) -- special characters (e.g. wildcards)
31
31
+
32
32
+
Group.link("@boolean", g.Boolean) -- boolean literals
33
33
+
Group.link("@number", g.Number) -- numeric literals
34
34
+
Group.link("@float", g.Float) -- floating-point number literals
35
35
+
36
36
+
-- Functions {{{1
37
37
+
Group.link("@function", g.Function) -- function definitions
38
38
+
Group.link("@function.builtin", g.Function) -- built-in functions
39
39
+
-- Group.link("@function.call", g.UnknownThing) -- function calls
40
40
+
Group.link("@function.macro", g.Function) -- preprocessor macros
41
41
+
42
42
+
Group.link("@method", g.Function) -- method definitions
43
43
+
-- Group.link("@method.call", g.UnknownThing) -- method calls
44
44
+
45
45
+
Group.link("@constructor", g.Function) -- constructor calls and definitions
46
46
+
Group.link("@parameter", g.Normal) -- parameters of a function
47
47
+
48
48
+
-- Keywords {{{1
49
49
+
Group.link("@keyword", g.Keyword) -- various keywords
50
50
+
Group.link("@keyword.function", g.Keyword) -- keywords that define a function (e.g. `func` in Go, `def` in Python)
51
51
+
Group.link("@keyword.operator", g.Keyword) -- operators that are English words (e.g. `and` / `or`)
52
52
+
Group.link("@keyword.return", g.Keyword) -- keywords like `return` and `yield`
53
53
+
54
54
+
Group.link("@conditional", g.Conditional) -- keywords related to conditionals (e.g. `if` / `else`)
55
55
+
Group.link("@repeat", g.Repeat) -- keywords related to loops (e.g. `for` / `while`)
56
56
+
-- Group.link("@debug", g.UnknownThing) -- keywords related to debugging
57
57
+
Group.link("@label", g.Label) -- GOTO and other labels (e.g. `label:` in C)
58
58
+
Group.link("@include", g.Include) -- keywords for including modules (e.g. `import` / `from` in Python)
59
59
+
Group.link("@exception", g.Exception) -- keywords related to exceptions (e.g. `throw` / `catch`)
60
60
+
61
61
+
-- Types {{{1
62
62
+
Group.link("@type", g.Type) -- type or class definitions and annotations
63
63
+
Group.link("@type.builtin", g.Type) -- built-in types
64
64
+
-- Group.link("@type.definition", g.UnknownThing) -- type definitions (e.g. `typedef` in C)
65
65
+
-- Group.link("@type.qualifier", g.UnknownThing) -- type qualifiers (e.g. `const`)
66
66
+
67
67
+
-- Group.link("@storageclass", g.UnknownThing) -- visibility/life-time modifiers
68
68
+
-- Group.link("@storageclass.lifetime", g.UnknownThing) -- life-time modifiers (e.g. `static`)
69
69
+
-- Group.link("@attribute", g.UnknownThing) -- attribute annotations (e.g. Python decorators)
70
70
+
-- Group.link("@field", g.UnknownThing) -- object and struct fields
71
71
+
Group.link("@property", g.Identifier) -- similar to `@field`
72
72
+
73
73
+
-- Identifiers {{{1
74
74
+
Group.link("@variable", g.Identifier) -- various variable names
75
75
+
-- Group.link("@variable.builtin", g.UnknownThing) -- built-in variable names (e.g. `this`)
76
76
+
77
77
+
Group.link("@constant", g.Constant) -- constant identifiers
78
78
+
-- Group.link("@constant.builtin", g.UnknownThing) -- built-in constant values
79
79
+
-- Group.link("@constant.macro", g.UnknownThing) -- constants defined by the preprocessor
80
80
+
81
81
+
Group.new("@namespace", c.namespace, c.none) -- modules or namespaces
82
82
+
Group.link("@symbol", g.Special) -- symbols or atoms
83
83
+
84
84
+
-- Text {{{1
85
85
+
Group.link("@text", g.Normal) -- non-structured text
86
86
+
Group.link("@text.strong", g.Normal) -- bold text
87
87
+
Group.link("@text.emphasis", g.Normal) -- text with emphasis
88
88
+
Group.link("@text.underline", g.Normal) -- underlined text
89
89
+
Group.link("@text.strike", g.Normal) -- strikethrough text
90
90
+
Group.link("@text.title", g.Normal) -- text that is part of a title
91
91
+
Group.link("@text.literal", g.Normal) -- literal or verbatim text
92
92
+
Group.link("@text.uri", g.UnknownThing) -- URIs (e.g. hyperlinks)
93
93
+
Group.link("@text.math", g.UnknownThing) -- math environments (e.g. `$ ... $` in LaTeX)
94
94
+
Group.link("@text.environment", g.UnknownThing) -- text environments of markup languages
95
95
+
Group.link("@text.environment.name", g.UnknownThing) -- text indicating the type of an environment
96
96
+
Group.link("@text.reference", g.Normal) -- text references, footnotes, citations, etc.
97
97
+
98
98
+
-- I think the defaults are fine here?
99
99
+
-- Group.link("@text.todo", g.TODO) -- todo notes
100
100
+
Group.link("@text.note", g.Note) -- info notes
101
101
+
Group.link("@text.warning", g.Warning) -- warning notes
102
102
+
Group.link("@text.danger", g.Error) -- danger/error notes
103
103
+
104
104
+
Group.link("@text.diff.add", g.DiffAdd) -- added text (for diff files)
105
105
+
Group.link("@text.diff.delete", g.DiffDelete) -- deleted text (for diff files)
106
106
+
107
107
+
-- Tags {{{1
108
108
+
Group.link("@tag", g.Special) -- XML tag names
109
109
+
Group.link("@tag.attribute", g.Special) -- XML tag attributes
110
110
+
Group.link("@tag.delimiter", g.Special) -- XML tag delimiters
111
111
+
112
112
+
-- Conceal {{{1
113
113
+
-- Group.link("@conceal", g.UnknownThing) -- for captures that are only used for concealing
114
114
+
115
115
+
-- Spell {{{1
116
116
+
-- Group.link("@spell", g.UnknownThing) -- for defining regions to be spellchecked
117
117
+
-- Other/Unknown {{{1
118
118
+
119
119
+
-- Non-standard
120
120
+
-- @variable.global
121
121
+
122
122
+
-- Undocumented or invalid?
123
123
+
Group.link("@annotation", g.UnknownThing)
124
124
+
--Group.link("@parameter.reference", g.UnknownThing)
125
125
+
-- }}}1
126
126
+
end
127
127
+
128
128
+
return M
129
129
+
130
130
+
-- vim: set fdm=marker:
+3
-127
lua/wombat_lua/init.lua
···
1
1
-
-- vim: set fdm=marker:
2
2
-
-- TODO port work config changes?
3
3
-
4
1
local wombat_colors = require "wombat_lua.colors"
5
2
6
3
local Color = require("colorbuddy.init").Color
···
163
160
Group.link("DiagnosticError", g.Error)
164
161
Group.link("DiagnosticUnnecessary", g.NonText)
165
162
166
166
-
-- Syntax - Treesitter {{{1
167
167
-
Group.new("UnknownThing", c.norm, c.unknown)
168
168
-
169
169
-
-- Structured following:
170
170
-
-- https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#highlights
171
171
-
172
172
-
-- Misc {{{2
173
173
-
174
174
-
-- @errors is TS errors. Wildly noisy if you enable it.
175
175
-
--Group.link("@error", g.ErrorMsg) -- syntax/parser errors
176
176
-
Group.link("@comment", g.Comment) -- line and block comments
177
177
-
--Group.link("@none", g.UnknownThing) -- completely disable the highlight
178
178
-
--Group.link("@preproc", g.UnknownThing) -- various preprocessor directives & shebangs
179
179
-
--Group.link("@define", g.UnknownThing) -- preprocessor definition directives
180
180
-
Group.link("@operator", g.Operator) -- symbolic operators (e.g. `+` / `*`)
181
181
-
182
182
-
-- Punctuation {{{2
183
183
-
Group.link("@punctuation.delimiter", g.Special) -- delimiters (e.g. `;` / `.` / `,`)
184
184
-
Group.link("@punctuation.bracket", g.Special) -- brackets (e.g. `()` / `{}` / `[]`)
185
185
-
Group.link("@punctuation.special", g.Special) -- special symbols (e.g. `{}` in string interpolation)
186
186
-
187
187
-
-- Literals {{{2
188
188
-
Group.link("@string", g.String) -- string literals
189
189
-
Group.link("@string.regex", g.String) -- regular expressions
190
190
-
Group.link("@string.escape", g.StringEscape) -- escape sequences
191
191
-
Group.link("@string.special", g.String) -- other special strings (e.g. dates)
192
192
-
193
193
-
Group.link("@character", g.Character) -- character literals
194
194
-
Group.link("@character.special", g.Character) -- special characters (e.g. wildcards)
195
195
-
196
196
-
Group.link("@boolean", g.Boolean) -- boolean literals
197
197
-
Group.link("@number", g.Number) -- numeric literals
198
198
-
Group.link("@float", g.Float) -- floating-point number literals
199
199
-
200
200
-
-- Functions {{{2
201
201
-
Group.link("@function", g.Function) -- function definitions
202
202
-
Group.link("@function.builtin", g.Function) -- built-in functions
203
203
-
--Group.link("@function.call", g.UnknownThing) -- function calls
204
204
-
Group.link("@function.macro", g.Function) -- preprocessor macros
205
205
-
206
206
-
Group.link("@method", g.Function) -- method definitions
207
207
-
-- Group.link("@method.call", g.UnknownThing) -- method calls
208
208
-
209
209
-
Group.link("@constructor", g.Function) -- constructor calls and definitions
210
210
-
Group.link("@parameter", g.Normal) -- parameters of a function
211
211
-
212
212
-
-- Keywords {{{2
213
213
-
Group.link("@keyword", g.Keyword) -- various keywords
214
214
-
Group.link("@keyword.function", g.Keyword) -- keywords that define a function (e.g. `func` in Go, `def` in Python)
215
215
-
Group.link("@keyword.operator", g.Keyword) -- operators that are English words (e.g. `and` / `or`)
216
216
-
Group.link("@keyword.return", g.Keyword) -- keywords like `return` and `yield`
217
217
-
218
218
-
Group.link("@conditional", g.Conditional) -- keywords related to conditionals (e.g. `if` / `else`)
219
219
-
Group.link("@repeat", g.Repeat) -- keywords related to loops (e.g. `for` / `while`)
220
220
-
--Group.link("@debug", g.UnknownThing) -- keywords related to debugging
221
221
-
Group.link("@label", g.Label) -- GOTO and other labels (e.g. `label:` in C)
222
222
-
Group.link("@include", g.Include) -- keywords for including modules (e.g. `import` / `from` in Python)
223
223
-
Group.link("@exception", g.Exception) -- keywords related to exceptions (e.g. `throw` / `catch`)
224
224
-
225
225
-
-- Types {{{2
226
226
-
Group.link("@type", g.Type) -- type or class definitions and annotations
227
227
-
Group.link("@type.builtin", g.Type) -- built-in types
228
228
-
--Group.link("@type.definition", g.UnknownThing) -- type definitions (e.g. `typedef` in C)
229
229
-
--Group.link("@type.qualifier", g.UnknownThing) -- type qualifiers (e.g. `const`)
230
230
-
231
231
-
--Group.link("@storageclass", g.UnknownThing) -- visibility/life-time modifiers
232
232
-
--Group.link("@storageclass.lifetime", g.UnknownThing) -- life-time modifiers (e.g. `static`)
233
233
-
--Group.link("@attribute", g.UnknownThing) -- attribute annotations (e.g. Python decorators)
234
234
-
--Group.link("@field", g.UnknownThing) -- object and struct fields
235
235
-
Group.link("@property", g.Identifier) -- similar to `@field`
236
236
-
237
237
-
-- Identifiers {{{2
238
238
-
Group.link("@variable", g.Identifier) -- various variable names
239
239
-
--Group.link("@variable.builtin", g.UnknownThing) -- built-in variable names (e.g. `this`)
240
240
-
241
241
-
Group.link("@constant", g.Constant) -- constant identifiers
242
242
-
--Group.link("@constant.builtin", g.UnknownThing) -- built-in constant values
243
243
-
--Group.link("@constant.macro", g.UnknownThing) -- constants defined by the preprocessor
244
244
-
245
245
-
Group.new("@namespace", c.namespace, c.none) -- modules or namespaces
246
246
-
Group.link("@symbol", g.Special) -- symbols or atoms
247
247
-
248
248
-
-- Text {{{2
249
249
-
Group.link("@text", g.Normal) -- non-structured text
250
250
-
Group.link("@text.strong", g.Normal) -- bold text
251
251
-
Group.link("@text.emphasis", g.Normal) -- text with emphasis
252
252
-
Group.link("@text.underline", g.Normal) -- underlined text
253
253
-
Group.link("@text.strike", g.Normal) -- strikethrough text
254
254
-
Group.link("@text.title", g.Normal) -- text that is part of a title
255
255
-
Group.link("@text.literal", g.Normal) -- literal or verbatim text
256
256
-
Group.link("@text.uri", g.UnknownThing) -- URIs (e.g. hyperlinks)
257
257
-
Group.link("@text.math", g.UnknownThing) -- math environments (e.g. `$ ... $` in LaTeX)
258
258
-
Group.link("@text.environment", g.UnknownThing) -- text environments of markup languages
259
259
-
Group.link("@text.environment.name", g.UnknownThing) -- text indicating the type of an environment
260
260
-
Group.link("@text.reference", g.Normal) -- text references, footnotes, citations, etc.
261
261
-
262
262
-
-- I think the defaults are fine here?
263
263
-
-- Group.link("@text.todo", g.TODO) -- todo notes
264
264
-
Group.link("@text.note", g.Note) -- info notes
265
265
-
Group.link("@text.warning", g.Warning) -- warning notes
266
266
-
Group.link("@text.danger", g.Error) -- danger/error notes
267
267
-
268
268
-
Group.link("@text.diff.add", g.DiffAdd) -- added text (for diff files)
269
269
-
Group.link("@text.diff.delete", g.DiffDelete) -- deleted text (for diff files)
270
270
-
271
271
-
-- Tags {{{2
272
272
-
Group.link("@tag", g.Special) -- XML tag names
273
273
-
Group.link("@tag.attribute", g.Special) -- XML tag attributes
274
274
-
Group.link("@tag.delimiter", g.Special) -- XML tag delimiters
275
275
-
276
276
-
-- Conceal {{{2
277
277
-
--Group.link("@conceal", g.UnknownThing) -- for captures that are only used for concealing
278
278
-
279
279
-
-- Spell {{{2
280
280
-
--Group.link("@spell", g.UnknownThing) -- for defining regions to be spellchecked
281
281
-
282
282
-
-- Non-standard
283
283
-
-- @variable.global
284
284
-
285
285
-
-------------------------------------
286
286
-
287
287
-
-- Undocumented or invalid?
288
288
-
Group.link("@annotation", g.UnknownThing)
289
289
-
--Group.link("@parameter.reference", g.UnknownThing)
163
163
+
require("wombat_lua.groups.treesitter").build(Group, c, g, s)
290
164
291
165
Group.new("TODO", c.none, c.none) -- what even set this?
292
166
···
304
178
305
179
Group.new("IblIndent", c.bg_more_subtle, c.none, s.none)
306
180
Group.new("IblScope", c.norm_accent, c.none, s.none)
181
181
+
182
182
+
-- vim: set fdm=marker: