Get the original syntax highlighting file

Store the custom syntax highlighting file

This is where rkward looks for syntax highlighting definition files:

~/.local/share/katepart5/syntax

This directory may not exist, so it has to be created. Other sources say that

~/.local/share/org.kde.syntax-highlighting/syntax

is also an option for Kate.

ln -s ~/git/syntax-highlighting/data/syntax/r.xml ~/.local/share/katepart5/syntax/r.xml
ln -s ~/git/syntax-highlighting/data/syntax/r.xml ~/.local/share/org.kde.syntax-highlighting/syntax/r.xml

Then, you can just stick to working with the r.xml file in the git repository.

Adjust the XML syntax highlighting file

Example 1: Make NA different from NULL and Inf

<list name="NA">
  <item>NA</item>
  <item>NA_integer_</item>
  <item>NA_real_</item>
  <item>NA_complex_</item>
  <item>NA_character_</item>
  <item>is.na</item>
</list>

In the context “Common rules”, add:

<keyword attribute="Missing Values" context="#stay" String="NA"/>

In the <itemDatas>, add a new <itemData> for “Missing values”:

<itemData name="Missing Values" defStyleNum="dsDataType" spellChecking="false" bold="1"/>

See the documentation which unique defStyleNums are available.


Last updated: 2020-11-06

Back to the front page