summaryrefslogtreecommitdiff
path: root/rc/filetype/eruby.kak
blob: 9237be73611caecf4597c72197c494deb243b3f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# eRuby
# http://www2a.biglobe.ne.jp/~seki/ruby/erb.html

hook global BufCreate '.*\.erb' %{
  set-option buffer filetype eruby
}

hook global WinSetOption filetype=eruby %{
  require-module eruby
  add-highlighter window/eruby ref eruby
  hook -group eruby-indent 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-comment-tag region '<%#' '%>' fill comment
  add-highlighter shared/eruby/simple-execution-tag region (?<=<%) '%>' ref ruby
}