-
Notifications
You must be signed in to change notification settings - Fork 15
/
OrgExtended.sublime-syntax-template
342 lines (325 loc) · 11.7 KB
/
OrgExtended.sublime-syntax-template
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
file_extensions:
- org
- org_archive
# Generic parent scope of the file
scope: text.orgmode
version: 2
variables:
datetime: "<\\d{4}-\\d{2}-\\d{2}(?:\\s*\\w{3})?\\s*(\\d{2}\\:\\d{2}(-\\d{2}\\:\\d{2})?)?\\s*([+]*\\d[wdmy])?>"
unscheddatetime: "\\[\\d{4}-\\d{2}-\\d{2}(?:\\s*\\w{3})?\\s*(\\d{2}\\:\\d{2})?\\s*([+]*\\d[wdmy])?\\]"
tags: "(^|):[\\w\\d:]+:"
priority: '\s*\[((\#A)|(\#B)|(\#C)|(\#D)|(\#E)|(\#[a-zA-Z0-9]+))\]\s+'
state: (TODO)|(BLOCKED)|(WAITING)|(CANCELLED)|(DONE)|(MEETING)|(PHONE)|(NOTE)|(FLAG)|(CLEANUP)|(IN-PROGRESS)|(DOING)|(NEXT)|(REASSIGNED)|(FIXED)
beginmrk: BEGIN_SRC|begin_src
endmrk: END_SRC|end_src
beginsrc: '(\s*\#\+({{beginmrk}})\s+)'
endsrc: '(\s*\#\+({{endmrk}})\s*)'
contexts:
# The prototype context is prepended to all contexts but those setting
# meta_include_prototype: false.
#prototype:
#- include: comments
header-matches:
- match: $
pop: true
- match: ({{state}}\s+)?({{priority}})?[^\[\]:\n]*(\[\d*[/%]\d*\])?({{tags}})?
captures:
2: variable.parameter orgmode.state.todo
3: variable.parameter orgmode.state.blocked
4: variable.parameter orgmode.state.waiting
5: variable.parameter orgmode.state.cancelled
6: variable.parameter orgmode.state.done
7: variable.parameter orgmode.state.meeting
8: variable.parameter orgmode.state.phone
9: variable.parameter orgmode.state.note
10: variable.parameter orgmode.state.flag
11: variable.parameter orgmode.state.cleanup
12: variable.parameter orgmode.state.inprogress
13: variable.parameter orgmode.state.doing
14: variable.parameter orgmode.state.next
15: variable.parameter orgmode.state.reassigned
16: variable.parameter orgmode.state.fixed
17: string.quoted orgmode.priority
18: string.quoted orgmode.priority.value
19: string.quoted orgmode.priority.value.a
20: string.quoted orgmode.priority.value.b
21: string.quoted orgmode.priority.value.c
22: string.quoted orgmode.priority.value.d
23: string.quoted orgmode.priority.value.e
24: string.quoted orgmode.priority.value.general
25: string.quoted orgmode.checkbox.summary
26: entity.name.tag.orgmode orgmode.tags.header
main:
# The main context is the initial starting point of our syntax.
# Include other contexts from here (or specify them directly).
#- include: keywords
#- include: numbers
#- include: strings
# --- # Todo investigate what this actually is?
- match: ^\s*\-\-\- [^\n]*
scope: comment orgmode.page
# ~~~~~ # Todo investigate what this is?
- match: ^\s*[~]+ [^\n]*
scope: comment orgmode.break
# Generic headline, TODO: Make multiple of these so we can color them
# and sub captures so we can hide the extraneous stars
# embed_scope: entity.name.function.orgmode orgmode.headline
- match: ^\s*[*]\s+
push:
- meta_scope: entity.name.class.orgmode orgmode.headline
- include: header-matches
- match: ^\s*([*])[*]\s+
captures:
1: comment orgmode.preamble
push:
- meta_scope: entity.name.function.orgmode orgmode.headline2
- include: header-matches
- match: ^\s*([*][*])[*]\s+
captures:
1: comment orgmode.preamble
push:
- meta_scope: entity.other.attribute-name.orgmode orgmode.headline3
- include: header-matches
- match: ^\s*([*][*][*])[*]\s+
captures:
1: comment orgmode.preamble
push:
- meta_scope: entity.name.section.orgmode orgmode.headline4
- include: header-matches
- match: ^\s*([*][*][*][*])[*]\s+
captures:
1: comment orgmode.preamble
push:
- meta_scope: entity.name.type.orgmode orgmode.headline5
- include: header-matches
- match: ^\s*([*][*][*][*][*])[*]\s+
captures:
1: comment orgmode.preamble
scope: orgmode.headline6
push:
- meta_scope: entity.name.filename orgmode.headline6
- include: header-matches
- match: ^\s*([*][*][*][*][*][*])[*]\s+
captures:
1: comment orgmode.preamble
scope: orgmode.headline7
push:
- meta_scope: entity.name.filename orgmode.headline7
- include: header-matches
- match: ^\s*([*][*][*][*][*][*][*])[*]\s+
captures:
1: comment orgmode.preamble
scope: orgmode.headline8
push:
- meta_scope: entity.name.filename orgmode.headline8
- include: header-matches
- match: ^\s*([*][*][*][*][*][*][*][*])[*]\s+
captures:
1: comment orgmode.preamble
scope: orgmode.headline9
push:
- meta_scope: entity.name.filename orgmode.headline9
- include: header-matches
- match: ^\s*(\|.+\|)
captures:
1: markup.raw.block orgmode.table.block
scope: orgmode.table
# DEADLINE: <DATETIME>
- match: "(DEADLINE:)\\s+({{datetime}})"
captures:
1: keyword orgmode.statekeyword
2: markup.italic orgmode.datetime
scope: orgmode.deadline
# SCHEDULED: <DATETIME>
- match: "(SCHEDULED:)\\s+({{datetime}})"
captures:
1: keyword orgmode.statekeyword
2: markup.italic orgmode.datetime
scope: orgmode.scheduled
# CLOSED: [DATETIME]
- match: "(CLOSED:)\\s+({{unscheddatetime}})"
captures:
1: keyword orgmode.statekeyword
2: markup.italic orgmode.unscheddatetime
scope: orgmode.closed
# numbered list
- match: "^\\s*([0-9]+[.)])\\s+(([^:]+\\s+)(::))?"
captures:
1: constant.numeric
3: keyword orgmode.definition
4: punctuation orgmode.definition.marker
scope: orgmode.numberedlist
# bullet list
- match: "^\\s*(\\-) (([^:]+\\s+)(::))?"
captures:
1: constant.character
3: keyword orgmode.definition
4: punctuation orgmode.definition.marker
scope: orgmode.tack.minus
# bullet list
- match: "^\\s*(\\+) (([^:]+\\s+)(::))?"
captures:
1: constant.character
3: keyword orgmode.definition
4: punctuation orgmode.definition.marker
scope: orgmode.tack.plus
# To follow up: -> and =>
- match: "^\\s*(\\-\\>|\\=\\>) "
scope: orgmode.follow_up
# [-] Checkbox
- match: (\[[ ]\])\s?
scope: string orgmode.checkbox
- match: (\[([xX])\])\s?
scope: orgmode.checkbox.checked
captures:
1: string
2: keyword orgmode.checkbox.checked
- match: (\[([\-])\])\s?
scope: orgmode.checkbox.blocked
captures:
1: string
2: constant.other orgmode.checkbox.blocked
# [#/#] Checkbox summary
- match: (\[\d*[/%]\d*\])
scope: string orgmode.checkbox.summary
# [[link]]
- match: \[(\[([^\]]+)\])\]
captures:
1: orgmode.link.textblock
2: comment orgmode.link.text.href
scope: markup.underline.link orgmode.link
# [[link][name]]
- match: \[(\[([^\]]+)\])(\[([^\]]+)\])\]
captures:
1: orgmode.link.hrefblock
2: comment orgmode.link.href
3: orgmode.link.textblock
4: markup.bold orgmode.link.text
scope: markup.underline.link orgmode.link
- match: http[s]?://[^ \t]+
scope: orgmode.link.href
- match: \b([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})\b
scope: orgmode.email
# {{{results(=hello=)}}}
- match: '\{\{\{results\(([^)]+)\)\}\}\}'
scope: comment orgmode.results.inline
captures:
1: keyword orgmode.results.value
# {numerical_value}
- match: \{(\d+)\}
scope: orgmode.link.internal.number
# {{headline}}
- match: \{\{(.+?)\}\}
scope: orgmode.link.internal.headline
# :TAG:
- match: "(^|\\s):[\\w\\d:]+:"
scope: entity.name.tag.orgmode orgmode.tags
# [code] block, not sure what these are.
- match: \[code\]\s*
push: code
- match: ^\s*Traceback \(most recent call last\):\s*$
push: pythonstack
- match: (^|\s)\*[^*]+\*(^|\s)
scope: markup.bold orgmode.bold
- match: (^|\s)(/[^/]+/)($|\s)
scope: markup.italic orgmode.italics
- match: \b(_[^_]+_)\b
scope: markup.underline orgmode.underline
- match: (^|\s)\+[^\+]+\+(^|\s)
scope: markup.underline orgmode.strikethrough
- match: (^|\s)~[^~]+~(^|\s)
scope: orgmode.code
- match: (^|\s)=[^=]+=(^|\s)
scope: orgmode.verbatim
- match: '(<<)([^>]+)(>>)'
captures:
1: orgmode.target.bracket
2: comment orgmode.link.text.href orgmode.target
3: orgmode.target.bracket
scope: markup.underline.link
- match: '(\s*\#\+(BEGIN_CENTER|begin_center)\s*)'
captures:
1: orgmode.fence
push:
- meta_scope: constant.other orgmode.raw.block
- meta_content_scope: markup.raw.block orgmode.raw.block
- match: '(\s*\#\+(END_CENTER|end_center)\s*)'
captures:
1: orgmode.fence
pop: true
- match: '(\s*\#\+(BEGIN_VERSE|begin_verse)\s*)'
captures:
1: orgmode.fence
push:
- meta_scope: constant.other orgmode.raw.block
- meta_content_scope: markup.raw.block orgmode.raw.block
- match: '(\s*\#\+(END_VERSE|end_verse)\s*)'
captures:
1: orgmode.fence
pop: true
- match: '(\s*\#\+(BEGIN_QUOTE|begin_quote)\s*)'
captures:
1: orgmode.fence
push:
- meta_scope: constant.other orgmode.raw.block
- meta_content_scope: markup.raw.block orgmode.raw.block
- match: '(\s*\#\+(END_QUOTE|end_quote)\s*)'
captures:
1: orgmode.fence
pop: true
- match: '(\s*\#\+(BEGIN_NOTES|begin_notes)\s*)'
captures:
1: constant.other orgmode.fence
embed: scope:text.orgmode
escape: '(\s*\#\+(END_NOTES|end_notes)\s*)'
embed_scope: markup.raw.block orgmode.raw.block
escape_captures:
1: constant.other orgmode.fence
- match: '(\s*\#\+(BEGIN_EXAMPLE|begin_example)\s*)'
captures:
1: constant.other orgmode.fence
embed: scope:text.orgmode
escape: '(\s*\#\+(END_EXAMPLE|end_example)\s*)'
embed_scope: markup.raw.block orgmode.raw.block
escape_captures:
1: constant.other orgmode.fence
{{INSERT_LANGUAGES_HERE}}
# #+SOMETHING:
# But not a dynamic block
# Use negative look ahead to avoid matching begin and end dynamic blocks
- match: '^\s*(\#\+(?!(TBLFM|tblfm|BEGIN|END|begin|end))([a-zA-Z][a-zA-Z0-9_-]+)(\s*\[[a-zA-Z0-9_-]+\]\s*)?\:)\s*(.*)'
scope: orgmode.controltag
captures:
1: keyword orgmode.controltag.tag
5: comment orgmode.controltag.text
# #+TBLFM:
# But not a dynamic block
# Use negative look ahead to avoid matching begin and end dynamic blocks
- match: '^\s*(\#\+(TBLFM|tblfm))\:\s*(.*)'
scope: orgmode.table orgmode.controltag orgmode.tblfm
captures:
1: keyword orgmode.controltag.tag
3: comment orgmode.controltag.text
# #+BEGIN: NAME dynamic block support
- match: '((\s*\#\+BEGIN:|\#\+begin:)\s+([a-zA-Z0-9]+)\s+(.*)?\s*)'
captures:
1: constant.other orgmode.fence.dynamicblock
2: orgmode.fence.dynamicblock.begin
3: keyword orgmode.fence.dynamicblock.name
4: variable.parameter orgmode.fence.dynamicblock.params
embed: scope:text.orgmode
escape: '(^\s*\#\+END:\s*|\#\+end:\s*)'
embed_scope: markup.raw.block orgmode.raw.block.dynamicblock
escape_captures:
1: constant.other orgmode.fence.dynamicblock.end
code:
- meta_scope: text
- match: \s*\[/code\]
pop: true
pythonstack:
- meta_scope: orgmode.python.traceback
- match: "^\\s*\\w+: .+$"
pop: true