1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-25 20:41:49 +03:00
kakoune/rc/base/swift.kak
2017-01-04 13:04:27 +01:00

28 lines
1.6 KiB
Plaintext

hook global BufCreate .*\.(swift) %{
set buffer filetype swift
}
add-highlighter -group / regions -default code swift \
string %{(?<!')"} %{(?<!\\)(\\\\)*"} '' \
comment /\* \*/ '' \
comment // $ ''
add-highlighter -group /swift/string fill string
add-highlighter -group /swift/comment fill comment
add-highlighter -group /swift/comment regex "\<(TODO|XXX|MARK)\>" 0:red
add-highlighter -group /swift/code regex %{\<(true|false|nil)\>|\<-?(?!\$)\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
add-highlighter -group /swift/code regex "\<(let|var|while|in|for|if|else|do|switch|case|default|break|continue|return|try|catch|throw|new|delete|and|or|not|operator|explicit|func|import|return|init|deinit|get|set)\>" 0:keyword
add-highlighter -group /swift/code regex "\<as\>[!?]?" 0:keyword
add-highlighter -group /swift/code regex "(\$[0-9])\>" 0:keyword
add-highlighter -group /swift/code regex "\<(const|mutable|auto|namespace|inline|static|volatile|class|struct|enum|union|public|protected|private|typedef|virtual|friend|extern|typename|override|final|required|convenience|dynamic)\>" 0:attribute
add-highlighter -group /swift/code regex "\<(self|nil|id|super)\>" 0:value
add-highlighter -group /swift/code regex "\<(Bool|String|UInt|UInt16|UInt32|UInt64|UInt8)\>" 0:type
add-highlighter -group /swift/code regex "\<(IBAction|IBOutlet)\>" 0:attribute
add-highlighter -group /swift/code regex "@\w+\>" 0:attribute
hook -group swift-highlight global WinSetOption filetype=swift %{ add-highlighter ref swift }
hook -group swift-highlight global WinSetOption filetype=(?!swift).* %{ remove-highlighter swift }