TextMate syntax coloring and Rails 2.0

Now that the Ruby on Rails 2.0 Preview Release is out, I'm playing around with it. First thing I noticed, while minor, is that TextMate's syntax coloring for "HTML (Rails)" doesn't recognize the new view naming scheme. "rhtml" is now replaced by "html.erb" as the file extension.

It's a simple fix, however. Just open up the Bundle Editor, go to the "Rails" bundle, then the "HTML (Rails)" language definition, and add 'erb' to the filetypes array on the second line. Like:

JavaScript:
  1. {   scopeName = 'text.html.ruby';
  2.     fileTypes = ( 'rhtml', 'erb' );
  3. ...

7 responses to “TextMate syntax coloring and Rails 2.0”

  1. keithv

    awesome! thanks for helping me fix this niggle.

  2. Jason

    Weird, It only works on the layouts folder, but when I’ve added it on the HTML bundle, it works

    just add ‘html.erb’ on the fileTypes:

    e.g.

    fileTypes = ( ‘html’, ‘htm’, ’shtml’, ‘xhtml’, ‘phtml’, ‘php’, ‘inc’, ‘tmpl’, ‘tpl’, ‘html.erb’);

  3. Eric Pugh

    Thanks for the tip. I’ve been slacking on fixing this annoyance and finally saw how simple it was and it worked great!

  4. TextMate and Rails 2.0 « Origin: Rails Example Applications

    [...] What to do? A few people have suggested tweaks using TextMate’s Bundle Editor (here and here). A better option is the new TextMate Rails 2.0 bundle now under development by Dr Nic Williams. [...]

  5. 6502.fr

    Coloration syntaxique des fichiers .html.erb dans TextMate…

    TextMate Version 1.5.7 (1436) ne reconnaît pas l’extension .html.erb dans le bundle Ruby on Rails. Pour l’ajouter, ouvrir le Bundle Editor, filtrer par Langage, et sélectionner HTML (Rails) sous Ruby on Rails. Ajouter l’extension :

  6. jmr

    that’s cool, but …

    now i have a new erb.icns file.
    how do i tell TextMate to use it with .erb files??

  7. Devon

    You are the MAN, Greg!

Leave a Reply

Switch to our mobile site