Syntax highlighting in gedit not working automatically

夙愿已清 提交于 2019-12-12 09:01:59

问题


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?


回答1:


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



回答2:


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.




回答3:


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/



来源:https://stackoverflow.com/questions/1201890/syntax-highlighting-in-gedit-not-working-automatically

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!