add kakoune highlighting file
s-ol
1 year, 8 months ago
0 | ### subv.kak - Semantic Highlighting for SubV | |
1 | ||
2 | # Detection | |
3 | hook global BufCreate .*[.](subv) %{ | |
4 | set-option buffer filetype subv | |
5 | } | |
6 | ||
7 | # Highlighters | |
8 | add-highlighter shared/subv regions | |
9 | add-highlighter shared/subv/comment region '#' '$' fill comment | |
10 | add-highlighter shared/subv/code default-region group | |
11 | add-highlighter shared/subv/code/segment regex '^\s+(== [^\n ]+( 0x[\da-z]+)?)' 1:builtin | |
12 | add-highlighter shared/subv/code/label regex '^([^ \n]+:)' 1:variable | |
13 | add-highlighter shared/subv/code/partnum regex '\b(-?[\da-f]+|([^/ \n]+))/([^/ \n]+)(/([^/ \n]+))?\b' 5:+d 1:value 2:variable 3:meta | |
14 | add-highlighter shared/subv/code/opcode regex '^\s+([\da-f]{2})/(\w+)' 0:+b@keyword | |
15 | ||
16 | # Initialization | |
17 | hook -group subv-highlight global WinSetOption filetype=subv %{ | |
18 | add-highlighter window/subv ref subv | |
19 | ||
20 | hook -once -always window WinSetOption filetype=.* %{ | |
21 | remove-highlighter window/subv | |
22 | } | |
23 | ||
24 | set-option buffer comment_line '# ' | |
25 | set-option buffer tabstop 2 | |
26 | set-option buffer indentwidth 2 | |
27 | } |