From bbdcc5fdec31e01a2a880b10d9135d240bd05715 Mon Sep 17 00:00:00 2001 From: Jan-Jaap Korpershoek Date: Fri, 30 Oct 2020 16:29:32 +0100 Subject: [PATCH 1/2] Add very basic svelte support --- rc/filetype/svelte.kak | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 rc/filetype/svelte.kak 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}"" + " +} From 93e85bebbb2b41cdd8a08c95c8d5ddd257d57990 Mon Sep 17 00:00:00 2001 From: Jan-Jaap Korpershoek Date: Mon, 9 Nov 2020 09:53:10 +0100 Subject: [PATCH 2/2] Don't use hook_param_capture_1 --- rc/filetype/svelte.kak | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rc/filetype/svelte.kak b/rc/filetype/svelte.kak index 091508a2..b7e52610 100644 --- a/rc/filetype/svelte.kak +++ b/rc/filetype/svelte.kak @@ -5,18 +5,18 @@ hook global WinCreate .*\.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 window ModeChange pop:insert:.* -group "svelte-trim-indent" html-trim-indent + hook window InsertChar '>' -group "svelte-indent" html-indent-on-greater-than + hook window InsertChar \n -group "svelte-indent" html-indent-on-new-line hook -once -always window WinSetOption "filetype=.*" " - remove-hooks window ""%val{hook_param_capture_1}-.+"" + remove-hooks window ""svelte-.+"" " } hook -group svelte-highlight global WinSetOption filetype=(svelte) %{ - add-highlighter "window/%val{hook_param_capture_1}" ref html + add-highlighter "window/svelte" ref html hook -once -always window WinSetOption "filetype=.*" " - remove-highlighter ""window/%val{hook_param_capture_1}"" + remove-highlighter ""window/svelte"" " }