summaryrefslogtreecommitdiff
path: root/rc/filetype/swift.kak
diff options
context:
space:
mode:
authorAlex Leferry 2 <alexherbo2@gmail.com>2019-03-18 19:56:34 +0100
committerAlex Leferry 2 <alexherbo2@gmail.com>2019-03-21 01:06:16 +0100
commitc0dccdd90dd615cf663d95fd94fbdbdf2a88b165 (patch)
treecb48fb1b7fb74e6e3b98a62f6e2768686bb75c98 /rc/filetype/swift.kak
parentf87e844244d5ee81e9c1ceb04c354726002ae760 (diff)
Add categories in rc/
Closes #2783
Diffstat (limited to 'rc/filetype/swift.kak')
-rw-r--r--rc/filetype/swift.kak28
1 files changed, 28 insertions, 0 deletions
diff --git a/rc/filetype/swift.kak b/rc/filetype/swift.kak
new file mode 100644
index 00000000..1526cadb
--- /dev/null
+++ b/rc/filetype/swift.kak
@@ -0,0 +1,28 @@
+hook global BufCreate .*\.(swift) %{
+ set-option buffer filetype swift
+}
+
+add-highlighter shared/swift regions
+add-highlighter shared/swift/code default-region group
+add-highlighter shared/swift/string region %{(?<!')"} %{(?<!\\)(\\\\)*"} fill string
+add-highlighter shared/swift/comment region /\* \*/ group
+add-highlighter shared/swift/line_comment region // $ ref swift/comment
+
+add-highlighter shared/swift/comment/ fill comment
+add-highlighter shared/swift/comment/ regex "\b(TODO|XXX|MARK)\b" 0:red
+
+add-highlighter shared/swift/code/ regex %{\b(true|false|nil)\b|\b-?(?!\$)\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
+add-highlighter shared/swift/code/ regex "\b(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)\b" 0:keyword
+add-highlighter shared/swift/code/ regex "\bas\b[!?]?" 0:keyword
+add-highlighter shared/swift/code/ regex "(\$[0-9])\b" 0:keyword
+add-highlighter shared/swift/code/ regex "\b(const|mutable|auto|namespace|inline|static|volatile|class|struct|enum|union|public|protected|private|typedef|virtual|friend|extern|typename|override|final|required|convenience|dynamic)\b" 0:attribute
+
+add-highlighter shared/swift/code/ regex "\b(self|nil|id|super)\b" 0:value
+add-highlighter shared/swift/code/ regex "\b(Bool|String|UInt|UInt16|UInt32|UInt64|UInt8)\b" 0:type
+add-highlighter shared/swift/code/ regex "\b(IBAction|IBOutlet)\b" 0:attribute
+add-highlighter shared/swift/code/ regex "@\w+\b" 0:attribute
+
+hook -group swift-highlight global WinSetOption filetype=swift %{
+ add-highlighter window/swift ref swift
+ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/swift }
+}