From ceb859271f3c3082e6bca43279a7d8938c4e376a Mon Sep 17 00:00:00 2001 From: Alex Leferry 2 Date: Wed, 3 Jun 2020 14:57:15 +0200 Subject: [PATCH] Add support for eRuby http://www2a.biglobe.ne.jp/~seki/ruby/erb.html --- rc/filetype/eruby.kak | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 rc/filetype/eruby.kak diff --git a/rc/filetype/eruby.kak b/rc/filetype/eruby.kak new file mode 100644 index 000000000..c25cd8a9f --- /dev/null +++ b/rc/filetype/eruby.kak @@ -0,0 +1,26 @@ +# eRuby +# http://www2a.biglobe.ne.jp/~seki/ruby/erb.html + +hook global BufCreate '.*\.html\.erb' %{ + set-option buffer filetype eruby +} + +hook global WinSetOption filetype=eruby %{ + require-module eruby + add-highlighter window/eruby ref eruby + hook -group eruby window InsertChar '\n' html-indent-on-new-line + hook -always -once window WinSetOption filetype=.* %{ + remove-highlighter window/eruby + remove-hooks window eruby + } +} + +provide-module eruby %{ + require-module ruby + require-module html + add-highlighter shared/eruby regions + add-highlighter shared/eruby/html default-region ref html + add-highlighter shared/eruby/simple-expression-tag region '<%=' '%>' ref ruby + add-highlighter shared/eruby/simple-execution-tag region '<%' '%>' ref ruby + add-highlighter shared/eruby/simple-comment-tag region '<%#' '%>' fill comment +}