Page Contents
Nano syntax highlighting
- Save asterisk.nanorc e.g. in /usr/local/share/nano/asterisk.nanorc
- Add include "/usr/local/share/nano/asterisk.nanorc" to either /etc/nanorc or ~/.nanorc
asterisk.nanorc
My current suggestion
I have modified some colors to make it all visible on my light background, added colour for technology and made it highlight contexts. The keyword regex could be optimized, I will work on that part.Updated 2007-11-18, optimized (hopefully) the application regex, added some other stuff.
Updated 2011-07-17, changing colour for priority "1" to blue. (Csabka)
Updated 2014-10-1, enabled syntax highlighting files named extensions.conf. (imcdona)
## Asterisk syntax highlighting
## v.03 2007-11-18
## Comments/updates - jmcanfield@gmail.com
## Modified by Johan Adler from 2007-11-17 and forward, tested using Debian and Asterisk 1.2.13
## 2007-11-18
## Currently optimized for dialplan (extensions.conf and any included files)
## Application regex altered and hopefully optimized.
## Note that the order of regex's is important
## color is case sensitive, icolor case insensitive
syntax "asterisk" "/.*/asterisk/.*\.conf$|extensions.conf"
## Separating characters
color green "(\{|\}|\(|\)|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
## Labels
color blue "^(\s)*exten(\s)*=>(\s)*((s|t|a|i|o|fax)|[0-9*#]+|_([XZN0-9*#]*(\[[XZN0-9*#]*\])*[XZN0-9*#]*)*(\.)?),([0-9]|n)\([A-Za-z0-9_\-]+\)"
## Priorities
color green "^(\s)*exten(\s)*=>(\s)*((s|t|a|i|o|fax)|[0-9*#]+|_([XZN0-9*#]*(\[[XZN0-9*#]*\])*[XZN0-9*#]*)*(\.)?),([02-9]|n)"
color blue "^(\s)*exten(\s)*=>(\s)*((s|t|a|i|o|fax)|[0-9*#]+|_([XZN0-9*#]*(\[[XZN0-9*#]*\])*[XZN0-9*#]*)*(\.)?),(1)"
## Comma back to black
color black "^(\s)*exten(\s)*=>(\s)*((s|t|a|i|o|fax)|[0-9*#]+|_([XZN0-9*#]*(\[[XZN0-9*#]*\])*[XZN0-9*#]*)*(\.)?),"
## Extensions
color red "^(\s)*exten(\s)*=>(\s)*((s|t|a|i|o|fax)|[0-9*#]+|_([XZN0-9*#]*(\[[XZN0-9*#]*\])*[XZN0-9*#]*)*(\.)?)"
## Word 'exten' in dialplan
color magenta "^(\s)*exten(\s)*=>"
## included context
color green "^(\s)*include(\s)*=>(\s)*\<.+\>"
## 'include' in dialplan
color magenta "^(\s)*include(\s)*=>"
## Conditionals
color blue "\$\[.+\]"
## Contexts
color green "^\[.+\]"
## Strings
color magenta ""(\\.|[^"])*"" "'(\\.|[^'])*'"
## Technologies
color magenta "\<(SIP/|IAX2/|Zap/|Local/).*\>"
## Anything following NoOp, same color as comments (will not be executed)
## Colored before variables, since they will be substituted
color yellow "\<NoOp\>. ...