Syntax highlighting in gedit not working automatically
Asked Answered
H

3

3

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?

Horology answered 29/7, 2009 at 17:39 Comment(0)
C
3

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
Coddle answered 4/5, 2010 at 10:46 Comment(2)
Is there also a solution for users that don't have root?Nacre
I don't think this is a problem anymore. The question is almost 5 (OMG!) years old. If it is: have you tried installing gmate? github.com/gmate/gmate. If you have the required dependencies intsalled you can install it on your user folder.Harrar
D
1

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.

Denitrify answered 25/3, 2010 at 18:28 Comment(2)
In my case, the above note helped me to find out, that Lua highlighting was attached to 'text/x-lua' mimetype; thanks.Schaal
also, I had to add some stuff to ~/.local/share/mime/packages/<SOMETHING>.xml, see: library.gnome.org/admin/system-admin-guide/stable/…Schaal
G
0

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/

Giannagianni answered 29/7, 2009 at 17:51 Comment(1)
Yeah, I've done that but it is not still not automatically working with Ruby files. I've noticed that the syntax highlighting is working automatically for other languages.Horology

© 2022 - 2024 — McMap. All rights reserved.