2015-07-18 23:58:24 +03:00
|
|
|
# http://docker.com
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
# See https://docs.docker.com/reference/builder
|
|
|
|
|
|
|
|
# Detection
|
|
|
|
# ‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2017-11-04 10:45:58 +03:00
|
|
|
hook global BufCreate .*/?Dockerfile(\.\w+)?$ %{
|
2017-11-03 10:34:41 +03:00
|
|
|
set-option buffer filetype dockerfile
|
2015-07-18 23:58:24 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
# Highlighters
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2017-11-04 10:45:58 +03:00
|
|
|
add-highlighter shared/ regions -default code dockerfile \
|
|
|
|
string '"' '(?<!\\)(\\\\)*"' '' \
|
|
|
|
string "'" "'" '' \
|
|
|
|
comment '#' $ ''
|
|
|
|
|
2018-05-07 00:29:52 +03:00
|
|
|
evaluate-commands %sh{
|
2017-11-04 10:45:58 +03:00
|
|
|
# Grammar
|
|
|
|
keywords="ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL"
|
|
|
|
keywords="${keywords}|MAINTAINER|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR"
|
|
|
|
|
|
|
|
# Add the language's grammar to the static completion list
|
|
|
|
printf %s\\n "hook global WinSetOption filetype=dockerfile %{
|
2018-06-17 06:30:40 +03:00
|
|
|
set window static_words ONBUILD|${keywords}
|
|
|
|
}" | tr '|' ' '
|
2017-11-04 10:45:58 +03:00
|
|
|
|
|
|
|
# Highlight keywords
|
|
|
|
printf %s "
|
|
|
|
add-highlighter shared/dockerfile/code regex '^(?i)(ONBUILD\h+)?(${keywords})\b' 2:keyword
|
|
|
|
add-highlighter shared/dockerfile/code regex '^(?i)(ONBUILD)\h+' 1:keyword
|
|
|
|
"
|
|
|
|
}
|
2015-07-18 23:58:24 +03:00
|
|
|
|
2017-11-04 10:45:58 +03:00
|
|
|
add-highlighter shared/dockerfile/code regex '\$\{[\w_]+\}' 0:value
|
|
|
|
add-highlighter shared/dockerfile/code regex '\$[\w_]+' 0:value
|
2015-07-18 23:58:24 +03:00
|
|
|
|
2017-11-04 10:45:58 +03:00
|
|
|
add-highlighter shared/dockerfile/string fill string
|
2017-10-28 06:00:51 +03:00
|
|
|
add-highlighter shared/dockerfile/comment fill comment
|
2015-07-18 23:58:24 +03:00
|
|
|
|
|
|
|
# Initialization
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2017-10-28 06:00:51 +03:00
|
|
|
hook -group dockerfile-highlight global WinSetOption filetype=dockerfile %{ add-highlighter window ref dockerfile }
|
|
|
|
hook -group dockerfile-highlight global WinSetOption filetype=(?!dockerfile).* %{ remove-highlighter window/dockerfile }
|