2015-09-11 10:40:22 +03:00
|
|
|
# http://gittup.org/tup/
|
|
|
|
#
|
|
|
|
|
|
|
|
# Detection
|
|
|
|
# ‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2017-11-04 09:39:23 +03:00
|
|
|
hook global BufCreate .*/?Tup(file|rules)(\.\w+)?$ %{
|
2017-11-03 10:34:41 +03:00
|
|
|
set-option buffer filetype tupfile
|
2015-09-11 10:40:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
# Highlighters
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2017-10-28 06:00:51 +03:00
|
|
|
add-highlighter shared/ regions -default code tupfile \
|
2015-09-11 10:40:22 +03:00
|
|
|
string '"' (?<!\\)(\\\\)*" '' \
|
|
|
|
comment '#' $ ''
|
|
|
|
|
2017-10-28 06:00:51 +03:00
|
|
|
add-highlighter shared/tupfile/string fill string
|
|
|
|
add-highlighter shared/tupfile/comment fill comment
|
2015-09-11 10:40:22 +03:00
|
|
|
|
2017-10-28 06:00:51 +03:00
|
|
|
add-highlighter shared/tupfile/code regex "\%[fbBeoOdg]\b" 0:value
|
2017-11-04 09:39:23 +03:00
|
|
|
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
|
2015-09-11 10:40:22 +03:00
|
|
|
|
|
|
|
# Initialization
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2017-10-28 06:00:51 +03:00
|
|
|
hook -group tupfile-highlight global WinSetOption filetype=tupfile %{ add-highlighter window ref tupfile }
|
|
|
|
hook -group tupfile-highlight global WinSetOption filetype=(?!tupfile).* %{ remove-highlighter window/tupfile }
|