With libgtksourceview, it's possible add syntax highlighting to Pluma, and other compatible text-editors by downloading language definitions and installing them in the correct location on your computer's file system.
This wiki post provides instructions for users on how install language definitions. You are free to add your own!
Note that any language syntax that isn't supported by
libgtksourceview2.0 but is supported by
libgtksourceview-3.0 (ie... it works in gedit on normal Ubuntu but not in Pluma) can likely be added in this same manner, by sym-linking the appropriate .lang files. Each tutorial will show you how to do this where applicable.
Adding Markdown highlighting using a symlink
Markdown syntax highlighting isn't supported in the version of
libgtksourceview2.0-common that ships with Ubuntu 14.04 and it's derivatives.
The easy fix seems to be to check that
libgtksourceview-3.0-common is installed, and if not, install it with your package manager of choice or from the terminal with:
sudo apt-get install libgtksourceview-3.0-common
After making sure it is installed, sym-link the
markdown.lang file included with
libgtksourceview-3.0-common to the appropriate spot for the applications that rely on
sudo ln -s /usr/share/gtksourceview-3.0/language-specs/markdown.lang /usr/share/gtksourceview-2.0/language-specs/markdown.lang
Make sure that all your text editor windows are closed and then restart Pluma and you should find syntax highlighting for Markdown files now works. For the record, this fix also works for newer versions of mousepad (the xfce editor), as it also relies upon
libgtksourceview2.0 for it's highlighting ability.
AsciiDoc is a feature-rich language that allows text documents to be transformed into valid DocBook XML or HTML5. It is popular with technical writers because it supports many features that Markdown does not including complex tables, docbook admonitions, cross-references and conditional text macros.
To install AsciiDoc support:
- Clone or download asciidoc-highlight from GitHub
- Follow the installation instructions if you just want to install support for a single user.
Alternatively copy the asciidoc.lang file to: /usr/share/gtksourceview-3.0/language-specs/
$ sudo cp /path/to/asciidoc.lang /usr/share/gtksourceview-3.0/language-specs/
Make a sym-link to /usr/share/gtksourceview-2.0/language-specs/
$ sudo ln -s /usr/share/gtksourceview-3.0/language-specs/asciidoc.lang /usr/share/gtksourceview-2.0/language-specs/asciidoc.lang
Restart your text editor and AsciiDoc will appear as an option in the syntax mode menu.
Alternatives to gtksourceview editors
Pluma is a fine editor for general text editing, and indeed it's even suitable for power users thanks to its rich plugin architecture and support for regular expressions. However there are alternatives that do not rely on gtksourceview for syntax highlighting.
Examples that run well on Ubuntu Mate include:
- SublimeText (non-free software)