-
Notifications
You must be signed in to change notification settings - Fork 0
/
syncat.kak
50 lines (39 loc) · 2.44 KB
/
syncat.kak
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
# Detection
hook global BufCreate .*[.](syncat) %{
set-option buffer filetype syncat-stylesheet
}
# Initialization
hook global WinSetOption filetype=syncat-stylesheet %[
require-module syntax-syncat-stylesheet
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window syncat.+ }
]
hook -group syncat-highlight global WinSetOption filetype=syncat-stylesheet %{
add-highlighter window/syncat ref syncat
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/syncat }
}
provide-module syntax-syncat-stylesheet %§
# Highlighters
add-highlighter shared/syncat regions
add-highlighter shared/syncat/items default-region group
add-highlighter shared/syncat/styles region "\{" "\}" group
add-highlighter shared/syncat/values region ":" ";" group
add-highlighter shared/syncat/comment region "//" "$" ref comment
add-highlighter shared/syncat/string region %{(?<!')"} (?<!\\)(\\\\)*" fill string
add-highlighter shared/syncat/regex region / (?<!\\)(\\\\)*/i? fill meta
add-highlighter shared/syncat/items/any regex "\*" 0:keyword
add-highlighter shared/syncat/items/modifier regex "&|>|~|\+" 0:keyword
add-highlighter shared/syncat/items/kind regex \b([a-zA-Z0-9-_]+)\b 1:type
add-highlighter shared/syncat/items/capture regex "<[a-zA-Z0-9-_]+>" 0:variable
add-highlighter shared/syncat/items/import regex \bimport\b 0:keyword
add-highlighter shared/syncat/items/variable regex "\$[a-zA-Z0-9-_]+\b" 0:variable
add-highlighter shared/syncat/items/ regex "//[^\n]*$" 0:comment
add-highlighter shared/syncat/values/important regex "!" 0:keyword
add-highlighter shared/syncat/values/number regex \b([0-9]+(\.[0-9]+)?)\b 1:value
add-highlighter shared/syncat/values/boolean regex \b(true|false)\b 1:value
add-highlighter shared/syncat/values/hexcolor regex (#[0-9a-fA-F]{6})\b 1:builtin
add-highlighter shared/syncat/values/namedcolor regex \b(br)?(red|blue|green|yellow|purple|cyan|black|white)\b 0:builtin
add-highlighter shared/syncat/values/variable regex "\$[a-zA-Z0-9-_]+\b" 0:variable
add-highlighter shared/syncat/styles/property regex \b([a-zA-Z0-9-_]+)\s*: 1:function
add-highlighter shared/syncat/styles/ ref syncat/values
add-highlighter shared/syncat/styles/ regex "//[^\n]*$" 0:comment
§