### subv.kak - Semantic Highlighting for SubV
# Detection
hook global BufCreate .*[.](subv) %{
set-option buffer filetype subv
}
# Highlighters
add-highlighter shared/subv regions
add-highlighter shared/subv/comment region '#' '$' fill comment
add-highlighter shared/subv/code default-region group
add-highlighter shared/subv/code/segment regex '^\s+(== [^\n ]+( 0x[\da-z]+)?)' 1:builtin
add-highlighter shared/subv/code/label regex '^([^ \n]+:)' 1:variable
add-highlighter shared/subv/code/partnum regex '\b(-?[\da-f]+|([^/ \n]+))/([^/ \n]+)(/([^/ \n]+))?\b' 5:+d 1:value 2:variable 3:meta
add-highlighter shared/subv/code/opcode regex '^\s+([\da-f]{2})/(\w+)' 0:+b@keyword
add-highlighter shared/subv/code/special regex '^\s+(@@)/(\w+)' 0:+b@operator
# Initialization
hook -group subv-highlight global WinSetOption filetype=subv %{
add-highlighter window/subv ref subv
hook -once -always window WinSetOption filetype=.* %{
remove-highlighter window/subv
}
set-option buffer comment_line '# '
set-option buffer tabstop 2
set-option buffer indentwidth 2
}