Update: I have posted an alternative way to do the same thing this post describes, the alternative way should be more reliable. See it here http://www.c3b.co.uk/2008/12/16/alternative-method-for-opening-smarty-templates-with-html-syntax-highlighting-in-gedit/
I’ve started using gedit as my code editor after a couple of niggles with bluefish and wanted my smarty templates (*.tpl) to use the same syntax highlighting as HTML. Not wanting to have to manually select the language each time I open a .tpl file I went searching for a way to add them to the definition of what an html file is. I was getting frustrated with all the references to a syntax highlighting tab in the preferences dialog that just didn’t exist! Even the help file in gedit 2.22.1 still mentions the syntax highlighting tab but I can assure you it’s not there.
The solution I came up with was to manually edit the HTML language definition file for gtksourceview which is what gedit uses to define the syntax highlighting. To achieve this you must change the following line in the /usr/share/gtksourceview-2.0/language-specs/html.lang file:
Or download my version here (html.lang) of the file and run the following command:
Backup existing file
cd /usr/share/gtksourceview-2.0/language-specs sudo cp html.lang html.lang_bkup
Then move the downloaded version of the file into place (this assumes you download the file and extracted it to your home directory)
sudo mv ~/html.lang /usr/share/gtksourceview-2.0/language-specs/html.lang
Restart gedit and when you next open a .tpl file it will be highlighted in the same way as an HTML file.