Add a cmake.kak file for highlighting cmake files

This commit is contained in:
Maxime Coste 2018-06-19 19:40:33 +10:00
parent 9053dadfc3
commit a6c8dcf305

22
rc/extra/cmake.kak Normal file
View File

@ -0,0 +1,22 @@
hook global BufCreate .+\.cmake|.*/CMakeLists.txt %{
set-option buffer filetype cmake
}
add-highlighter shared/ regions -match-capture -default code cmake \
comment '#' '$' '' \
argument '\w+\h*\(\K' '(?=\))' '\(' \
add-highlighter shared/cmake/argument regions -match-capture -default args argument \
quoted '"' '(?<!\\)(\\\\)*"' '' \
quoted '\[(=*)\[' '\](=*)\]' ''
add-highlighter shared/cmake/comment fill comment
add-highlighter shared/cmake/code regex '\w+\h*(?=\()' 0:meta
add-highlighter shared/cmake/argument/argument/args regex '\$\{\w+\}' 0:variable
add-highlighter shared/cmake/argument/argument/quoted fill string
add-highlighter shared/cmake/argument/argument/quoted regex '\$\{\w+\}' 0:variable
add-highlighter shared/cmake/argument/argument/quoted regex '\w+\h*(?=\()' 0:function
hook -group cmake-highlight global WinSetOption filetype=cmake %{ add-highlighter window ref cmake }
hook -group cmake-highlight global WinSetOption filetype=(?!cmake).* %{ remove-highlighter window/cmake }