Skip to content

Instantly share code, notes, and snippets.

@viral32111
Last active January 9, 2022 10:59
Show Gist options
  • Select an option

  • Save viral32111/a6e72ec8305152e6577e36720c026419 to your computer and use it in GitHub Desktop.

Select an option

Save viral32111/a6e72ec8305152e6577e36720c026419 to your computer and use it in GitHub Desktop.
Nano syntax highlighting for Dockerfiles
# Slightly modified version of github.com/mbentley/Dockerfile.nanorc
# Syntax highlighting for Dockerfiles
syntax "Dockerfile" "[D|d]ockerfile[^/]*$"
# Instructions
icolor red "^(FROM|MAINTAINER|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD|ARG|STOPSIGNAL)[[:space:]]"
# Brackets
color brightgreen "(\(|\)|\[|\])"
# Double Ampersand
color brightmagenta "&&"
# Comments
icolor cyan "^[[:space:]]*#.*$"
# Blank space at EOL
color ,green "[[:space:]]+$"
# Strings (single quote)
color brightyellow "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>" "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
# Strings (double quote)
color brightyellow ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>" "%[QW]?\[[^]]*\]" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!"
# Single and double quotes
color brightyellow "('|\")"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment