mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-27 20:44:56 +00:00
4d205ab9a3
Rewrite the gtksourceview highlighting file to make better use of available syntax options. This allows us to separate various contexts, and means we don't have to keep track of all conky keywords. Overview of changes: * Use separate contexts for config block and "lit string". * (lit string is the lua lit string [[ .. ]], we assume that this is used to contain text sections or template blocks) * Use "sub-string" highlighting to highlight parts of identifiers separately. * Added conky.text comments (from '#' to EOL). * Remove lists of keywords and instead rely on syntax implications. * Uses separate contexts for config 'key=val' and text '${var}'s. * Match escape sequences more precisely. * Lua and conky escape sequences matched separately; lua in normal strings and conky in literal strings. See escapes note. * Transition from camelCase to hyphen-separated names * Reword README to reflect changes Escapes note: We also match conky template escape sequences when in lua literal strings as it would be too messy to separate `conky.text` and `templateN = ` literal strings. We currently don't match time format escape sequences as this would require knowing which text variable we are in. This is only possible if we duplicate the `bracket-var` context (less painful than duplicating the `lua-literal-string` context). Signed-off-by: Matt Sturgeon <matt@sturgeon.me.uk>
32 lines
1.6 KiB
Markdown
32 lines
1.6 KiB
Markdown
# Gedit syntax highlighting
|
|
|
|
Note: this highlights based on syntax and does **NOT** attempt to validate arguments or keywords. The syntax highlighting is unlikely to be 100% accurate and is open to improvement.
|
|
|
|
The syntax highlighting will automatically be applied to all files with `conky` in their name. eg. `my_config.conky` (unfortunately it also triggers for the `conky.lang` file itself, you should set it to XML manually)
|
|
|
|
* [`gtksourceview` Syntax Highlight documentation][1]
|
|
* [Regex Tutorial](http://www.rexegg.com/)
|
|
* [Regex Testing](https://regex101.com/)
|
|
|
|
Developers: The main context (`id="conkyrc"`) is where gedit begins. This main context then references other sub-contexts. Each context can apply styles to itself, sub-strings from its regexs, or its contents (in the case of `<start><end>` "container" contexts). If you are ever confused by something, try searching for XML attributes in the [`gtksourceview` docs][1]. If you find a particuarly complex regex, try using the Regex Tester linked above, and bear in mind that `gtksourceview` adds some extra regex syntax (i.e. `\%[ ... ]` and `\%{ ... }`).
|
|
|
|
***
|
|
|
|
for medit v1.1.1:
|
|
` /usr/share/medit/language-specs/conky.lang`
|
|
|
|
for medit - older versions:
|
|
`/usr/share/medit-1/language-specs/conky.lang`
|
|
|
|
for gedit v2.x
|
|
` /usr/share/gtksourceview-2.0/language-specs/conky.lang`
|
|
or (for single user)
|
|
` ~/.local/share/gtksourceview-2.0/language-specs/conky.lang`
|
|
|
|
for gedit v3.x
|
|
` /usr/share/gtksourceview-3.0/language-specs/conky.lang`
|
|
or (for single user)
|
|
` ~/.local/share/gtksourceview-3.0/language-specs/conky.lang`
|
|
|
|
[1]: https://developer.gnome.org/gtksourceview/stable/lang-reference.html
|