Skip to content

Instantly share code, notes, and snippets.

@reoseah
Last active December 15, 2018 11:28
Show Gist options
  • Save reoseah/68b09dbad3098ae312c45ac6539be2b9 to your computer and use it in GitHub Desktop.
Save reoseah/68b09dbad3098ae312c45ac6539be2b9 to your computer and use it in GitHub Desktop.
Micro syntax for Asterisk *.conf files

Put in ~/.config/micro/syntax. Based on 'ini' syntax, modified to highlight templates, arrows => and ${interpolated strings}.

It will highlight all .conf files, including any non-Asterisk files with that extension.

filetype: asterisk
detect:
filename: "\\.conf$"
rules:
- constant.bool.true: "\\btrue\\b"
- constant.bool.false: "\\bfalse\\b"
- identifier: "^[[:space:]]*[^=]*="
- special: "^[[:space:]]*\\[.*\\]$"
- special: "^[[:space:]]*\\[.*\\]\\(.*\\)$"
- statement: "[=;]"
- statement: "=>"
- constant.string:
start: "\""
end: "\""
rules:
- include: "interpolatedstring"
- comment:
start: "#"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"
- comment:
start: ";"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"
# '${name}' or '#{name}'
- statement:
start: "\\${"
end: "}"
rules:
- constant.specialChar: "\\w"
filetype: interpolatedstring
detect:
# impossible regexp
filename: "\\b\\B"
rules:
# escaped chars, like '\n' or '\\'
- constant.specialChar: "\\\\."
# interpolation, like '${name}' or '#{name}'
- statement:
start: "\\W{"
end: "}"
rules:
- constant.specialChar: "\\w"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment