kakoune

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

cmake.kak (1362B)


      1 hook global BufCreate .+\.cmake|.*/CMakeLists.txt %{
      2     set-option buffer filetype cmake
      3 }
      4 
      5 hook global BufCreate .*/CMakeCache.txt %{
      6     set-option buffer filetype ini
      7 }
      8 
      9 hook global WinSetOption filetype=cmake %{
     10     require-module cmake
     11 }
     12 
     13 hook -group cmake-highlight global WinSetOption filetype=cmake %{
     14     add-highlighter window/cmake ref cmake
     15     hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cmake }
     16 }
     17 
     18 provide-module cmake %{
     19 
     20 add-highlighter shared/cmake regions
     21 add-highlighter shared/cmake/code default-region group
     22 add-highlighter shared/cmake/comment  region '#' '$' fill comment
     23 add-highlighter shared/cmake/argument region -recurse '\(' '\w+\h*\(\K' '(?=\))' regions
     24 
     25 add-highlighter shared/cmake/code/ regex '\w+\h*(?=\()' 0:meta
     26 
     27 add-highlighter shared/cmake/argument/args default-region regex '\$\{\w+\}' 0:variable
     28 add-highlighter shared/cmake/argument/comment  region '#' '$' fill comment
     29 add-highlighter shared/cmake/argument/quoted region '"' '(?<!\\)(\\\\)*"' group
     30 add-highlighter shared/cmake/argument/raw-quoted region -match-capture '\[(=*)\[' '\](=*)\]' ref cmake/argument/quoted
     31 
     32 add-highlighter shared/cmake/argument/quoted/ fill string
     33 add-highlighter shared/cmake/argument/quoted/ regex '\$\{\w+\}' 0:variable
     34 add-highlighter shared/cmake/argument/quoted/ regex '\w+\h*(?=\()' 0:function
     35 
     36 }