Articles

reStructuredText syntax highlighting in gedit

In howto on Nov 28, 2011 by theoryl Tagged: , , , , ,

A quick way to add reStructuredText syntax highlight to gedit 2.x is to “steal” from GMate, which consists of a set of plugins that makes gedit more similar to TextMate.

1. Download the .rst language specifications https://github.com/gmate/gmate/blob/master/lang-specs/rst.lang.
2. Put it into /usr/share/gtksourceview-2.0/language-specs/
3. Create .local/share/mime/packages/rst.xml with

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
  <mime-type type="text/restructured">
    <alias type="text/x-rst" />
    <comment xml:lang="en">reStructuredText document</comment>
    <glob pattern="*.rst"/>
  </mime-type>
</mime-info>

4. Do update-mime-database /usr/share/mime

That’s it. However, the syntax highlighting is quite limited (e.g. it doesn’t recognize directives, footnotes etc)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: