aboutsummaryrefslogtreecommitdiff
path: root/user/kakoune/qml.kak
blob: 697467f576639fa9433c86563e5f889536634209 (plain) (blame)
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
hook global BufCreate .+\.qml %{
    set-option buffer filetype qml
}

hook global WinSetOption filetype=qml %{
    require-module qml
    add-highlighter window/qml ref qml
    hook -once global WinSetOption filetype=.+\.(?!qml) %{
        remove-highlighter window/qml
    }
}

provide-module qml %{
    add-highlighter shared/qml regions
    add-highlighter shared/qml/comment-line region '//' '\n' fill comment
    add-highlighter shared/qml/comment-block region '/\*' '\*/' fill comment
    add-highlighter shared/qml/string region '"' '"' fill string
    add-highlighter shared/qml/other default-region group
    add-highlighter shared/qml/other/keywords regex \
        \b(import|as|property|final|readonly|required|default)\b 0:keyword
    add-highlighter shared/qml/other/numbers regex -?[0-9]+(\.[0-9]+)? 0:value
    add-highlighter shared/qml/other/booleans regex true|false 0:value
    # this one was kind of annoying :(
    add-highlighter shared/qml/other/type regex '([a-zA-Z]+ *)(\{.*\})' 1:type
    add-highlighter shared/qml/other/builtin-types regex \
        \b(bool|date|double|int|list|real|string|url|var(iant)?|void)\b 0:type
    add-highlighter shared/qml/other/function regex ([a-zA-Z]+[a-zA-Z0-9]*)\(.*\) 1:function
}