2015-07-18 22:58:24 +02:00
|
|
|
# http://docker.com
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
# See https://docs.docker.com/reference/builder
|
|
|
|
|
|
|
|
# Detection
|
|
|
|
# ‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2022-08-16 17:49:11 +02:00
|
|
|
hook global BufCreate .*/?Dockerfile(\..+)?$ %{
|
2017-11-03 08:34:41 +01:00
|
|
|
set-option buffer filetype dockerfile
|
2015-07-18 22:58:24 +02:00
|
|
|
}
|
|
|
|
|
2019-04-10 05:54:19 +02:00
|
|
|
# Initialization
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
hook global WinSetOption filetype=dockerfile %{
|
2019-03-13 06:24:33 +01:00
|
|
|
require-module dockerfile
|
2019-04-10 05:54:19 +02:00
|
|
|
set-option window static_words %opt{dockerfile_static_words}
|
|
|
|
}
|
|
|
|
|
|
|
|
hook -group dockerfile-highlight global WinSetOption filetype=dockerfile %{
|
|
|
|
add-highlighter window/dockerfile ref dockerfile
|
|
|
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/dockerfile }
|
2019-03-13 06:24:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
provide-module dockerfile %{
|
|
|
|
|
2015-07-18 22:58:24 +02:00
|
|
|
# Highlighters
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2018-06-30 01:49:57 +02:00
|
|
|
add-highlighter shared/dockerfile regions
|
|
|
|
add-highlighter shared/dockerfile/code default-region group
|
2018-07-02 12:59:12 +02:00
|
|
|
add-highlighter shared/dockerfile/double_string region '"' '(?<!\\)(\\\\)*"' fill string
|
|
|
|
add-highlighter shared/dockerfile/single_string region "'" "'" fill string
|
|
|
|
add-highlighter shared/dockerfile/comment region '#' $ fill comment
|
2017-11-04 08:45:58 +01:00
|
|
|
|
2018-05-06 23:29:52 +02:00
|
|
|
evaluate-commands %sh{
|
2017-11-04 08:45:58 +01: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
|
2019-04-10 05:54:19 +02:00
|
|
|
printf %s\\n "declare-option str-list dockerfile_static_words ONBUILD|${keywords}" | tr '|' ' '
|
2017-11-04 08:45:58 +01:00
|
|
|
|
|
|
|
# Highlight keywords
|
|
|
|
printf %s "
|
2018-06-30 01:49:57 +02:00
|
|
|
add-highlighter shared/dockerfile/code/ regex '^(?i)(ONBUILD\h+)?(${keywords})\b' 2:keyword
|
|
|
|
add-highlighter shared/dockerfile/code/ regex '^(?i)(ONBUILD)\h+' 1:keyword
|
2017-11-04 08:45:58 +01:00
|
|
|
"
|
|
|
|
}
|
2015-07-18 22:58:24 +02:00
|
|
|
|
2020-09-05 07:36:31 +02:00
|
|
|
add-highlighter shared/dockerfile/code/ regex (?<!\\)(?:\\\\)*\K\$\{[\w_]+\} 0:value
|
|
|
|
add-highlighter shared/dockerfile/code/ regex (?<!\\)(?:\\\\)*\K\$[\w_]+ 0:value
|
2015-07-18 22:58:24 +02:00
|
|
|
|
2019-03-13 06:24:33 +01:00
|
|
|
}
|