Erlang Syntax Highlighting
I have written a language definition file for GtkSourceView to get a nice syntax highlighting for Erlang with applications that use this component, e.g. Gnome’s standard editor gedit.
The highlighting looks like this:

Here is how to get this to work:
Install Erlang Language File
- Download the file erlang.lang.
- Copy the file to /usr/share/gtksourceview-1.0/language-specs/erlang.lang.
- Start gedit, open an Erlang file, and choose View > Highlight Mode > Sources > Erlang.
Automatically Recognize *.erl
If you want gedit to automatically recognize that all .erl files should be correctly highlighted, you have to define the mime type (more info is here):
- Create directory to override mime types, in the command line type
mkdirhier ~/.local/share/mime/packages
- Download the custom mime file Override.xml into this directory (if the file already exists, you have to copy the relevant lines by hand):
cd ~/.local/share/mime/packages wget http://martin.ankerl.com/files/Override.xml
- Update the mime database by merging the file:
update-mime-database ~/.local/share/mime
- Restart nautilus (or logout & login again):
killall nautilus
There you go, Erlang code in all its glory. Happy hacking!
Tags: editor, erlang, gedit, programming, syntax highlighting


May 6th, 2007 at 7:25 pm
The highlighting has one known bug: it cannot handle $” or $’ correctly. I don’t know how to fix this problem, can anyone help?
June 27th, 2007 at 6:59 pm
Freedesktop has just added the mime type, which is the requirement for gtksourceview to add the highlighting file.
see: http://bugzilla.gnome.org/show_bug.cgi?id=436528
July 23rd, 2007 at 12:34 pm
Thanks a lot!
That’s what I’ve wished for!!!
Cheers, Mathi
P.S.: Maybe put it on cean? It took me a while to find it…