Syntax Highlighting
Enabling conkyrc syntax highlighting
Vim
With BUILD_EXTRAS=ON, installation includes both the generated syntax file and
filetype detector. By default these are installed under
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/vim (normally
/usr/local/share/vim), preserving the existing installation layout.
Set -DVIM_RUNTIME_DIR=share/vim/vimfiles for distributions whose Vim runtime
uses that directory. The directory must be on Vim's runtimepath; check
:set runtimepath? in Vim. Relative paths follow CMAKE_INSTALL_PREFIX (and
cmake --install --prefix); absolute paths are also supported. Both respect
DESTDIR for staged package installs. Set -DVIM_RUNTIME_DIR= to skip installing
Vim files. BUILD_EXTRAS=OFF continues to disable all editor extras.
Enable filetype on and syntax on in Vim to detect and highlight *conkyrc
and conky.conf files. These bundled rules describe the legacy Conky syntax;
Lua configurations can instead use Vim's Lua filetype.
Gedit
With BUILD_EXTRAS=ON, installation includes conky.lang under
${CMAKE_INSTALL_DATAROOTDIR}/libgedit-gtksourceview-300/language-specs.
For gedit builds that use GtkSourceView 4, set
-DGEDIT_LANGUAGE_SPECS_DIR=share/gtksourceview-4/language-specs. Relative paths
follow the install prefix. Absolute paths are also supported. Set
-DGEDIT_LANGUAGE_SPECS_DIR= to skip installing the gedit file.
Choose a destination in gedit's language search path. For a custom system install
such as /opt/conky/share, add the data directory to XDG_DATA_DIRS if gedit
does not already search it.
Note: this highlights syntax only and does NOT attempt to validate arguments or keywords. It is unlikely to be 100% accurate, and improvements are welcome.
Syntax highlighting is automatically applied to files with conky in their
name, for example my_config.conky. Unfortunately, it also matches the
conky.lang file itself, which you should set to XML manually.
Developers: the main context (id="conkyrc") is where gedit starts. That
context then references other subcontexts. Each context can apply styles to
itself, to substrings matched by its regular expressions, or to its contents in
the case of <start><end> container contexts. If anything is unclear, search
the language definition reference for the relevant XML attributes. If you run into
a particularly complex regex, try the Regex Tester linked above, and keep in
mind that gtksourceview adds some extra regex syntax, such as \%[ ... ]
and \%{ ... }.
For medit v1.1.1:
/usr/share/medit/language-specs/conky.lang
For older versions of medit:
/usr/share/medit-1/language-specs/conky.lang
For GtkSourceView 2:
/usr/share/gtksourceview-2.0/language-specs/conky.lang
or, for a single user:
~/.local/share/gtksourceview-2.0/language-specs/conky.lang
For GtkSourceView 3:
/usr/share/gtksourceview-3.0/language-specs/conky.lang
or, for a single user:
~/.local/share/gtksourceview-3.0/language-specs/conky.lang
For GtkSourceView 4:
/usr/share/gtksourceview-4/language-specs/conky.lang
or, for a single user:
~/.local/share/gtksourceview-4/language-specs/conky.lang
For libgedit-gtksourceview:
/usr/share/libgedit-gtksourceview-300/language-specs/conky.lang
or, for a single user:
~/.local/share/libgedit-gtksourceview-300/language-specs/conky.lang