Midnight Commander syntax highlighting: add your own syntax
Exim is good for everyone, but its configuration is not like anything, respectively, and the lighting in it is boring-gray (see below), and to fix this annoying mistake, it was decided to delve into the bowels of Google on the subject of Midnight commander syntax highlight.
A brief summary of the searches is presented below
BEFORE:

According to man, the MS editor (man mcedit) looks for highlights in the ~ / .mc / cedit / Syntax
file or if there are no files then in $ PREFIX / share / mc / syntax / Syntax.
Warning . These files are viewed in this order and are searched until the first match. Therefore, if you write a Syntax file in your home directory, ONLY the syntaxes described in it will be determined (this applies to version MS 4.7.5, perhaps everything has changed in later versions).
A quick (but VERY inaccurate) method was found here . It simply replaces the syntax of an unknown type (file /usr/local/share/mc/syntax/unknown.syntax) with sh.syntax)
But this method is not high-quality and unsportsmanlike. Therefore, we will go the other way.
First, we go into $ PREFIX / share / mc / syntax / Syntax and at the very beginning put a link to the file we are developing: Which means: all files that start with configuration and are located in the exim folder are highlighted with the syntax from the exim.syntax file. Thus, any backups (configure_28_11_2010, configure.orig, configure.default, etc. - will also be highlighted).
A syntax can have one or more contexts. Context - everything that is enclosed between certain service characters \ words (delimiters) example: - everything that is between the paws is displayed in green (in our case, the line) - everything that is between # and the end of the line is brown (comment) Required context default to highlight what is not in any context.
In any context, service words are defined as follows: briefly about the parameters:
It would be nice to determine which characters do NOT indicate the end of a word. This is done using the
wholechars command :
Actually, we will start with the default context: - here we define whole words and their color Next: - define whole families of official words (everything that starts with
and to the end of the word
And go to other contexts: - line and single-line comment - Parameter assignment context It is also responsible for the lines in this context to be displayed in green: keyword "*" green, keyword '*' green , and service line break characters - in red .
AFTER these manipulations (without overloading the MS) our config began to look more attractive:

PS
Main sources: man mcedit
And also / usr / local / share / mc / syntax / Syntax
You can pick up the Exim.Syntax syntax file here
PPS If someone suddenly find the finished syntax file, then you are welcome to throw its link somewhere here
A brief summary of the searches is presented below
BEFORE:

Theory of MC syntax Highlight
According to man, the MS editor (man mcedit) looks for highlights in the ~ / .mc / cedit / Syntax
file or if there are no files then in $ PREFIX / share / mc / syntax / Syntax.
Warning . These files are viewed in this order and are searched until the first match. Therefore, if you write a Syntax file in your home directory, ONLY the syntaxes described in it will be determined (this applies to version MS 4.7.5, perhaps everything has changed in later versions).
Quick way
A quick (but VERY inaccurate) method was found here . It simply replaces the syntax of an unknown type (file /usr/local/share/mc/syntax/unknown.syntax) with sh.syntax)
But this method is not high-quality and unsportsmanlike. Therefore, we will go the other way.
Syntax Syntax
First, we go into $ PREFIX / share / mc / syntax / Syntax and at the very beginning put a link to the file we are developing: Which means: all files that start with configuration and are located in the exim folder are highlighted with the syntax from the exim.syntax file. Thus, any backups (configure_28_11_2010, configure.orig, configure.default, etc. - will also be highlighted).
file configure exim\sconfiguration
include exim.syntax
Contexts
A syntax can have one or more contexts. Context - everything that is enclosed between certain service characters \ words (delimiters) example: - everything that is between the paws is displayed in green (in our case, the line) - everything that is between # and the end of the line is brown (comment) Required context default to highlight what is not in any context.
context " " green
spellcheck
context exclusive # \n brown
Keywords
In any context, service words are defined as follows: briefly about the parameters:
keyword [whole|wholeright|wholeleft] [linestart] string foreground [background]
- whole - only whole words (otherwise even parts of a larger word will stand out
- wholeright - from the string string and to the right to the end of the word
- wholeleft - from string to left to end of word
- linestart - string should go at the beginning of the line
It would be nice to determine which characters do NOT indicate the end of a word. This is done using the
wholechars command :
wholechars abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_01234567890.-exim.Syntax
Actually, we will start with the default context: - here we define whole words and their color Next: - define whole families of official words (everything that starts with
context default
keyword = white
keyword : yellow
keyword ! red
keyword # brown
keyword \/\/ brown
keyword ${ green
keyword } green
keyword whole domainlist brightcyan
keyword whole begin brightcyan
keyword whole acl brightcyan
keyword whole warn cyan
keyword whole accept cyan
keyword whole reject cyan
keyword whole drop cyan
keyword whole deny cyan
.............
keyword wholeright smtp_* brightcyan
keyword wholeright rfc1413_* brightcyan
keyword wholeright recipients_max* brightcyan
keyword wholeright system_filter* brightcyan
keyword wholeright maildir_* brightcyan
keyword wholeright message_* brightcyan
keyword wholeright quota_warn_* brightcyan
keyword wholeright server_* brightcyan
.............
And go to other contexts: - line and single-line comment - Parameter assignment context It is also responsible for the lines in this context to be displayed in green: keyword "*" green, keyword '*' green , and service line break characters - in red .
context " " green
spellcheck
context exclusive # \n brown
context exclusive = \n magenta
keyword \\\n red
keyword \\ red
keyword \/\/ brown
keyword "*" green
keyword '*' greendomainlist relay_to_domains = local_domainsconclusions
AFTER these manipulations (without overloading the MS) our config began to look more attractive:

PS
Main sources: man mcedit
And also / usr / local / share / mc / syntax / Syntax
You can pick up the Exim.Syntax syntax file here
PPS If someone suddenly find the finished syntax file, then you are welcome to throw its link somewhere here