kakoune

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

scss.kak (1770B)


      1 # http://sass-lang.com
      2 # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
      3 
      4 # Detection
      5 # ‾‾‾‾‾‾‾‾‾
      6 
      7 hook global BufCreate .*[.](scss) %{
      8     set-option buffer filetype scss
      9 }
     10 
     11 # Initialization
     12 # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
     13 
     14 hook global WinSetOption filetype=scss %[
     15     require-module scss
     16 
     17     hook window ModeChange pop:insert:.* -group scss-trim-indent scss-trim-indent
     18     hook window InsertChar \n -group scss-indent scss-insert-on-new-line
     19     hook window InsertChar \n -group scss-indent scss-indent-on-new-line
     20     hook window InsertChar \} -group scss-indent scss-indent-on-closing-curly-brace
     21     set-option buffer extra_word_chars '_' '-'
     22 
     23     hook -once -always window WinSetOption filetype=.* %{ remove-hooks window scss-.+ }
     24 ]
     25 
     26 hook -group scss-highlight global WinSetOption filetype=scss %{
     27     add-highlighter window/scss ref scss
     28     hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/scss }
     29 }
     30 
     31 
     32 provide-module scss %[
     33 
     34 require-module css
     35 
     36 # Highlighters
     37 # ‾‾‾‾‾‾‾‾‾‾‾‾
     38 
     39 add-highlighter shared/scss regions
     40 add-highlighter shared/scss/core default-region group
     41 add-highlighter shared/scss/comment region ^\h*// $ fill comment
     42 
     43 add-highlighter shared/scss/core/ ref css
     44 add-highlighter shared/scss/core/ regex & 0:keyword
     45 add-highlighter shared/scss/core/ regex \$[A-Za-z][A-Za-z0-9_-]* 0:variable
     46 
     47 # Commands
     48 # ‾‾‾‾‾‾‾‾
     49 
     50 define-command -hidden scss-trim-indent      css-trim-indent
     51 define-command -hidden scss-insert-on-new-line            css-insert-on-new-line
     52 define-command -hidden scss-indent-on-new-line            css-indent-on-new-line
     53 define-command -hidden scss-indent-on-closing-curly-brace css-indent-on-closing-curly-brace
     54 
     55 ]