kakoune

Fork of kakoune, an acceptable text editor
git clone git://git.laack.co/kakoune.git
Log | Files | Refs

gjs.kak (2089B)


      1 # https://github.com/ember-template-imports/ember-template-imports
      2 # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
      3 
      4 # Detection
      5 # ‾‾‾‾‾‾‾‾‾
      6 
      7 hook global BufCreate .*[.](gjs) %{
      8     set-option buffer filetype gjs
      9 }
     10 
     11 hook global BufCreate .*[.](gts) %{
     12     set-option buffer filetype gts
     13 }
     14 
     15 # Initialization
     16 # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
     17 
     18 hook global WinSetOption filetype=(gjs|gts) %{
     19     require-module javascript
     20 
     21     hook window ModeChange pop:insert:.* -group "%val{hook_param_capture_1}-trim-indent" javascript-trim-indent
     22     hook window InsertChar .* -group "%val{hook_param_capture_1}-indent" javascript-indent-on-char
     23     hook window InsertChar \n -group "%val{hook_param_capture_1}-insert" javascript-insert-on-new-line
     24     hook window InsertChar \n -group "%val{hook_param_capture_1}-indent" javascript-indent-on-new-line
     25 
     26     hook -once -always window WinSetOption filetype=.* "
     27         remove-hooks window %val{hook_param_capture_1}-.+
     28     "
     29 }
     30 
     31 hook -group gjs-highlight global WinSetOption filetype=gjs %{
     32     require-module gjs
     33     add-highlighter window/gjs ref gjs
     34     hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/gjs }
     35 }
     36 
     37 hook -group gts-highlight global WinSetOption filetype=gts %{
     38     require-module gts
     39     add-highlighter window/gts ref gts
     40     hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/gts }
     41 }
     42 
     43 # Modules
     44 
     45 provide-module gjs %{
     46     require-module javascript
     47     require-module hbs
     48     require-module html
     49     maybe-add-hbs-to-html
     50 
     51     add-highlighter "shared/gjs" regions
     52     add-highlighter "shared/gjs/" default-region ref javascript
     53     add-highlighter "shared/gjs/hbs" region '<template>' '</template>' ref html
     54 }
     55 
     56 provide-module gts %{
     57     require-module javascript
     58     require-module hbs
     59     require-module html
     60     maybe-add-hbs-to-html
     61 
     62     add-highlighter "shared/gts" regions
     63     add-highlighter "shared/gts/" default-region ref typescript
     64     add-highlighter "shared/gts/hbs" region '<template>' '</template>' ref html
     65 }