summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Jaap Korpershoek <jjkorpershoek96@gmail.com>2020-10-30 16:29:32 +0100
committerJan-Jaap Korpershoek <jjkorpershoek96@gmail.com>2020-10-30 16:29:32 +0100
commitbbdcc5fdec31e01a2a880b10d9135d240bd05715 (patch)
treedc8ee690c6a2e5dae7700d62f966efbeaf87dc93
parent90043e7df04359ec9ef629fa46fc6a524673be84 (diff)
Add very basic svelte support
-rw-r--r--rc/filetype/svelte.kak22
1 files changed, 22 insertions, 0 deletions
diff --git a/rc/filetype/svelte.kak b/rc/filetype/svelte.kak
new file mode 100644
index 00000000..091508a2
--- /dev/null
+++ b/rc/filetype/svelte.kak
@@ -0,0 +1,22 @@
+hook global WinCreate .*\.svelte %[
+ set-option window filetype svelte
+]
+
+hook global WinSetOption filetype=(svelte) %{
+ require-module html
+
+ hook window ModeChange pop:insert:.* -group "%val{hook_param_capture_1}-trim-indent" html-trim-indent
+ hook window InsertChar '>' -group "%val{hook_param_capture_1}-indent" html-indent-on-greater-than
+ hook window InsertChar \n -group "%val{hook_param_capture_1}-indent" html-indent-on-new-line
+
+ hook -once -always window WinSetOption "filetype=.*" "
+ remove-hooks window ""%val{hook_param_capture_1}-.+""
+ "
+}
+
+hook -group svelte-highlight global WinSetOption filetype=(svelte) %{
+ add-highlighter "window/%val{hook_param_capture_1}" ref html
+ hook -once -always window WinSetOption "filetype=.*" "
+ remove-highlighter ""window/%val{hook_param_capture_1}""
+ "
+}