kakoune

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

tupfile.kak (1363B)


      1 # http://gittup.org/tup/
      2 #
      3 
      4 # Detection
      5 # ‾‾‾‾‾‾‾‾‾
      6 
      7 hook global BufCreate .*/?Tup(file|rules)(\.\w+)?$ %{
      8     set-option buffer filetype tupfile
      9 }
     10 
     11 # Initialization
     12 # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
     13 
     14 hook -group tupfile-highlight global WinSetOption filetype=tupfile %{
     15     require-module tupfile
     16 
     17     add-highlighter window/tupfile ref tupfile
     18     hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/tupfile }
     19 }
     20 
     21 
     22 provide-module tupfile %{
     23 
     24 # Highlighters
     25 # ‾‾‾‾‾‾‾‾‾‾‾‾
     26 
     27 add-highlighter shared/tupfile regions
     28 add-highlighter shared/tupfile/code default-region group
     29 add-highlighter shared/tupfile/string region '"' (?<!\\)(\\\\)*" fill string
     30 add-highlighter shared/tupfile/comment region '#' $ fill comment
     31 
     32 add-highlighter shared/tupfile/code/ regex '%[fbBeoOdg]\b' 0:value
     33 add-highlighter shared/tupfile/code/ regex '[$@]\([\w_]+\)' 0:value
     34 add-highlighter shared/tupfile/code/ regex '^\h*:\s*(foreach)\b' 1:keyword
     35 add-highlighter shared/tupfile/code/ regex '^\h*(\.gitignore)\b' 1:keyword
     36 add-highlighter shared/tupfile/code/ regex '^\h*\b(ifn?eq|ifn?def|else|endif|error|include|include_rules|run|preload|export)\b' 0:keyword
     37 add-highlighter shared/tupfile/code/ regex '^\h*\b(&?[\w_]+)\s*[:+]?=' 1:keyword
     38 add-highlighter shared/tupfile/code/ regex '`[^`\n]+`' 0:meta
     39 
     40 }