Shashank Tiwari bio photo

Shashank Tiwari

Entrepreneur, Technology Executive.

Email Twitter

Update: A small typo, an unnecessary “<” tag before xmlns in scala-mime.xml has been corrected. Thanks @win for finding the error. See the comments below for additional references.

The default text editor on Ubuntu, or for that matter any Gnome powered desktop, is gedit. If you are a developer like me, who isn’t a huge fan of IDE(s), there is a good chance you use gedit for some of your development. Gedit supports syntax highlighting for a number of languages but if you were hacking some Scala code using the editor, you wouldn’t find any syntax highlighting support out-of-the-box. However, the Scala folks offer gedit syntax highlighting support via the scala-tool-support subproject. To get it working with your gedit installation, do the following:

  1. Download the scala.lang file from You can checkout the source using svn or scrape the screen by simply copying the contents and pasting it into a file named scala.lang. On Ubuntu, using Ctrl-Shift and the mouse, helps accurately select and copy the content from the screen.
  2. Copy or move scala.lang file to ~/.gnome2/gtksourceview-1.0/language-specs/
  3. Create a file named scala-mime.xml at /usr/share/mime/packages/ using <pre class="wp-code-highlight prettyprint">sudo touch /usr/share/mime/packages/scala-mime.xml</pre>

  4. Add the following contents to scala-mime.xml: <pre class="wp-code-highlight prettyprint"><?xml version=”1.0” encoding=”UTF-8”?>



<mime-type type=”text/x-scala”>

<comment>Scala programming language</comment>

<glob pattern=”*.scala”/>



  1. Run <pre class="wp-code-highlight prettyprint">sudo update-mime-database /usr/share/mime</pre>

  2. Start (or restart, if its running) gedit and you now have scala syntax highlighting in place.