summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Konečný <DragonLichcz@gmail.com>2015-06-10 22:48:52 +0200
committerJiří Konečný <DragonLichcz@gmail.com>2015-06-13 10:27:22 +0200
commita25a9e1026df315eb06ea01fa46ae003dff0c086 (patch)
tree44f3c2cd1e8b7ab3bec6adc0b05c3a770e5862ab
parent409d804ee85074eed8bd94f616bc23284bdf5eb9 (diff)
Add syntax highlighter for kickstart files
-rw-r--r--rc/kickstart.kak35
1 files changed, 35 insertions, 0 deletions
diff --git a/rc/kickstart.kak b/rc/kickstart.kak
new file mode 100644
index 00000000..e2d49b0e
--- /dev/null
+++ b/rc/kickstart.kak
@@ -0,0 +1,35 @@
+hook global BufCreate .*\.ks %{
+ set buffer filetype kickstart
+}
+
+addhl -group / regions -default code kickstart \
+ comment (^|\h)\K\# $ '' \
+ double_string '"' (?<!\\)(\\\\)*" '' \
+ single_string "'" (?<!\\)(\\\\)*' '' \
+ packages '^\h*\K%packages\>' '^\h*\K%end\>' '' \
+ shell '^\h*\K%(pre|pre-install|post)\>' '^\h*\K%end\>' ''
+
+addhl -group /kickstart/code regex "^\h*\<(auth|authconfig|autopart|autostep|bootloader|btrfs|clearpart|cmdline|device|dmraid|driverdisk|fcoe|firewall|firstboot|group|graphical|halt|ignoredisk|install|cdrom|harddrive|liveimg|nfs|url|iscsi|iscsiname|keyboard|lang|logvol|logging|mediacheck|monitor|multipath|network|part|partition|poweroff|raid|realm|reboot|repo|rescue|rootpw|selinux|services|shutdown|sshkey|sshpw|skipx|text|timezone|updates|upgrade|user|vnc|volgroup|xconfig|zerombr|zfcp)\>" 1:keyword
+addhl -group /kickstart/code regex '(--\w+=? ?)([^-"\n][^\h\n]*)?' 1:attribute 2:string
+addhl -group /kickstart/code regex '%(include|ksappend)\>' 0:keyword
+
+addhl -group /kickstart/comment fill comment
+addhl -group /kickstart/single_string fill string
+addhl -group /kickstart/double_string fill string
+addhl -group /kickstart/packages regex "^\h*[\w-]*" 0:value
+addhl -group /kickstart/packages regex "#[^\n]*" 0:comment
+addhl -group /kickstart/packages regex "^\h*@[\w-]*" 0:attribute
+addhl -group /kickstart/packages regex '\`\h*\K%packages\>' 0:yellow
+addhl -group /kickstart/packages regex '^\h*%end\>' 0:yellow
+addhl -group /kickstart/shell regex '\`\h*\K%(pre-install|pre|post)\>' 0:yellow
+addhl -group /kickstart/shell regex '^\h*%end\>' 0:yellow
+addhl -group /kickstart/shell ref sh
+
+
+hook global WinSetOption filetype=kickstart %{
+ addhl ref kickstart
+}
+
+hook global WinSetOption filetype=(?!kickstart).* %{
+ rmhl kickstart
+}