I like to use gedit for coding with ruby on rails and it features syntax highlighting for ruby and html but unfortunately not for rhtml and erb files.
So in this article I will show you how to get syntax highlighting for .rhtml and .erb files within the gedit editor as shown here.
Gedit uses the GTK toolkit, which in turn has a configuration for language parsing and highlighting. The syntax files delivered with Ubuntu reside under
and the files can be extended or overruled by installing new files in your home directory under
This is a safer place for your changed files as the /user/share path might be changed with upgrades.
I have created based on the html.lang file an rhtml.lang file, which you find below.
So here are the two steps what you need to do:
First, create the following directory
mkdir -p ~/.local/share/gtksourceview-3.0/language-specs/
Second, downdload this file and copy it into the just created directory.
If you now restart gedit and load a file with the .rhtml and .erb ending you should see a result similar to the example above.