need help with a style for a .cfg
-
Hi all I have a .cfg file that I am trying to edit
it is hard to read
here is what I get
here is what I am looking for
I tried looking here
thanks for any help -
You are in the right area:
- the
COMMENT
styles affect the lines that start with#
- the
SECTION
styles affect the[QoLmod]
headers - the
ASSIGNMENT
styles affect the=
between the key and value - the
KEY
styles affect the setting name (likelastUsername
, to the left of the=
) - the
DEFAULT
styles affect the value (to the right of the=
) - I am not sure, but I am guessing the
DEFVAL
is an error condition (since it’s red in the default light-mode styler)
So you can set the colors for each of those styles to match your desires.
The “Properties” language appears to not recognize comments at the end of a setting – that’s most likely because either the “Lexilla” library that Notepad++ uses for parsing the files doesn’t recognize that variant of the loosely-related slew of file-types that make up the “Properties” and “INI” filetypes, or because there’s an option for Lexilla’s “Properties” lexing which Notepad++ doesn’t use; I haven’t looked into which it is. Either way, it would require a fix in Notepad++ and possibly a fix in Lexilla before it (though if it is an option, then you could make use of the PythonScript plugin, or similar, to automatically set that Lexilla option even though Notepad++ itself doesn’t).
For the comment-after-assignment, there is a possible workaround:
- install EnhanceAnyLexer plugin
- open your
QoLmod.cfg
- Plugins > EnhanceAnyLanguage > Enhance current language
- it will open
EnhanceAnyLexerConfig.ini
in your other View, and create a section called[properties file
]. You could set that section to
(making sure to not keep[properties file] 0x00aa00 = \S\s*\K#.*
excluded_styles
or to comment out that line)
and save theEnhanceAnyLexerConfig.ini
- Going forward, the plugin should change the end-of-line
# ....
comments to a shade of green. (It will happen automatically the next time you open properties files, once the plugin config has been saved)
The limitation with EnhanceAnyLexer is that it cannot change bold/italics/underline status, and cannot change background color. So it won’t exactly match the italicized normal COMMENTS style, but it will be close.
----
update: In the LexProps source code, I only seelexer.props.allow.initial.spaces
andfold.compact
, so as far as I can find, Lexilla does not provides a way to allow comments at the end of a line. As a result, someone would have to request that the Lexilla project add that feature, and they would have to implement and publish it, then Notepad++ would have to update to the most recent Lexilla.
Also, it appears thatDEFVAL
is used for the@
symbol for “default value”, not an error condition. - the