Create a custom syntax highlight in gedit

Solution 1:

Create and open your fortune language file:

sudo touch /usr/share/gtksourceview-3.0/language-specs/fortune.lang
sudo -i gedit /usr/share/gtksourceview-3.0/language-specs/fortune.lang

Paste the following:

<?xml version="1.0" encoding="UTF-8"?>
<language id="fortune" _name="Fortune" version="2.0" _section="Markup">
  <metadata>
    <property name="mimetypes">text/plain</property>
    <property name="globs">*.</property>
  </metadata>

  <styles>
    <style id="at"      _name="@ sign"  map-to="def:constant" />
    <style id="percent" _name="percent sign"  map-to="def:comment" />
  </styles>
  <definitions>
    <context id="fortune">
      <include>
        <context id="at" style-ref="at">
          <start>@</start>
          <end>$</end>
        </context>
        <context id="percent" style-ref="percent">
          <start>%</start>
          <end>$</end>
        </context>
      </include>
    </context>
  </definitions>
</language>

Make sure it is accessible:

sudo chmod 0644 /usr/share/gtksourceview-2.0/language-specs/screenplay.lang

Restart gedit.

Reference - my source answer

My pronouns are He / Him