Syntax highlighting in gedit not working automatically
Question
I'm trying to use Ubuntu for Rails development and I'm liking gedit except the syntax highlighting does not seem to work with out me setting it for each file I open. Should it not recognize a .rb
file a ruby file rather than me having to go into the menu and setting it as such?
Have I missed a setting somewhere?
Solution
Try to edit your /etc/mime.types file and add those “text/x-????” entries:
text/x-ruby-source rhtml html.erb erb
text/x-eruby rjs
text/x-yaml yml yaml
OTHER TIPS
Try opening up /usr/share/gtksourceview-2.0/language-specs/ruby.lang again and addding this line at the top of the section:
<property name="mimetypes=">application/x-ruby</property>
If that doesn't work, I'm stumped.
Syntax highlighting pulls its settings from XML lang files, although the Ruby lang file should automatically pick up on .rb files. To check, open the language file from /usr/share/gtksourceview-2.0/language-specs/ruby.lang and see if *.rb is mentioned.
<property name="globs">*.rb</property>
Adding more Ruby extensions to the lang files: http://blog.adsdevshop.com/2008/04/19/erb-syntax-highlighting-in-gedit/