1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-18 00:42:13 +03:00
kakoune/rc/filetype/tupfile.kak

41 lines
1.3 KiB
Plaintext
Raw Normal View History

# http://gittup.org/tup/
#
# Detection
# ‾‾‾‾‾‾‾‾‾
2017-11-04 09:39:23 +03:00
hook global BufCreate .*/?Tup(file|rules)(\.\w+)?$ %{
set-option buffer filetype tupfile
}
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group tupfile-highlight global WinSetOption filetype=tupfile %{
2019-03-14 00:00:59 +03:00
require-module tupfile
add-highlighter window/tupfile ref tupfile
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/tupfile }
2019-03-14 00:00:59 +03:00
}
2019-03-14 00:00:59 +03:00
provide-module tupfile %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/tupfile regions
add-highlighter shared/tupfile/code default-region group
add-highlighter shared/tupfile/string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/tupfile/comment region '#' $ fill comment
add-highlighter shared/tupfile/code/ regex '%[fbBeoOdg]\b' 0:value
add-highlighter shared/tupfile/code/ regex '[$@]\([\w_]+\)' 0:value
add-highlighter shared/tupfile/code/ regex '^\h*:\s*(foreach)\b' 1:keyword
add-highlighter shared/tupfile/code/ regex '^\h*(\.gitignore)\b' 1:keyword
add-highlighter shared/tupfile/code/ regex '^\h*\b(ifn?eq|ifn?def|else|endif|error|include|include_rules|run|preload|export)\b' 0:keyword
add-highlighter shared/tupfile/code/ regex '^\h*\b(&?[\w_]+)\s*[:+]?=' 1:keyword
add-highlighter shared/tupfile/code/ regex '`[^`\n]+`' 0:meta
2019-03-14 00:00:59 +03:00
}