Adding syntax highlighting to Pluma

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 libgtksourceview2.0.

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:

  1. Clone or download asciidoc-highlight from GitHub

  2. Follow the installation instructions if you just want to install support for a single user.

  3. 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/
  4. 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
  5. 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:

  • Geany
  • Atom
  • SublimeText (non-free software)

Nice tip!

I’ve made this a wiki post and edited it slightly. I mostly did this to demonstrate that wiki posts super cool and can be collaboratively maintained :sunglasses:


That’s awesome!

Man, I really like this forum/community software. Impressive.

1 Like

Great tip!

I had to do something similar to get AsciiDoc syntax working in gktcourceview compatible editors too. Might be worth noting in your tutorial your process is basically the same to add any language support of which there’s a gtksourceview language file available.

Thanks CGB! That was what I intended with the last paragraph, though that might not be clear enough.

I might split that paragraph up, to make it more noticeable.

Not worries, mate!

Incidentally, here's the AsciiDoc highlighter that I use in Pluma/Gedit et al:

I use AsciiDoc in my day job (technical writer) and markdown for everything else :smile:

1 Like

So @CGB, what you could do is edit the opening post to add instructions about how to install the acsiidoc highlighter, then edit the title to reflect that the post is more generic :smiley:

Just nudging you all, so that you realise Discourse is so much more that just a forum :sunglasses:

Ah, with you now @Wimpy - I’ll do that tomorrow morning my time :smile:

Made my changes and added asciidoc instructions

1 Like