From bab174b0ec98cb2ff5759477576145bb8b16b5f7 Mon Sep 17 00:00:00 2001 From: Jimmy Thrasher Date: Thu, 5 May 2016 09:33:39 -0400 Subject: [PATCH] Add swift.kak for Swift highlighting No autoindent logic at the moment --- rc/base/swift.kak | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 rc/base/swift.kak diff --git a/rc/base/swift.kak b/rc/base/swift.kak new file mode 100644 index 00000000..37fe584a --- /dev/null +++ b/rc/base/swift.kak @@ -0,0 +1,32 @@ +hook global BufCreate .*\.(swift) %{ + set buffer filetype swift +} + +addhl -group / regions -default code swift \ + string %{(?" 0:red + +addhl -group /swift/code regex %{\<(true|false|nil)\>|\<-?(?!\$)\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value +addhl -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 +addhl -group /swift/code regex "\[!?]?" 0:keyword +addhl -group /swift/code regex "(\$[0-9])\>" 0:keyword +addhl -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 + +addhl -group /swift/code regex "\<(self|nil|id|super)\>" 0:value +addhl -group /swift/code regex "\<(Bool|String|UInt|UInt16|UInt32|UInt64|UInt8)\>" 0:type +addhl -group /swift/code regex "\<(IBAction|IBOutlet)\>" 0:attribute +addhl -group /swift/code regex "@\w+\>" 0:attribute + +hook global WinSetOption filetype=swift %{ + addhl ref swift +} + +hook global WinSetOption filetype=(?!swift).* %{ + rmhl swift +}