I’m considering switching from textmate to sublime text 2 for my Ruby on Rails development. I very much like the customization options of the editor and the partial textmate plugin support. However, one thing I can’t figure out is how to make ST2 open my rspec (testing) files with the rspec syntax highlighting and all other ruby files with the default Ruby syntax.
What I did was:
- Open a Ruby file (.rb) and select “Open all with current extension as Ruby on Rails”
- Open a Rspec file, which are all names name_spec.rb, this made the file open up with Ruby on Rails highlighting
- Selected “Open all with current extension as Rspec”
- Now all files (including simple Ruby files) are opened as Rspec (as expected, but not the way I want it)
- Next I opened both the “rspec.sublime-settings” and “Ruby on Rails.sublime-settings” files
- I readded “rb” to the Ruby on Rails file, as it was automatically removed in step 3
- I changed “rb” to “spec.rb” in the Rspec.sublime-settings file
- I deleted the Ruby.sublime-settings file (it was basically empty now)
But now all files are again opened in the “Ruby on Rails” syntax. So there could be two problems at work here;
-
the sublime-settings “extensions” hash only allows for the part after the “.” (dot) to be set, in which case all Rails files can only have a single syntax set as the standard, which would probably make ST2 not the best RoR editor, but I doubt thats the case here.
-
Somehow, the RoR settings take precedence over the Rspec settings, but I don’t know why.
Anyone here who figured this out and could help me out here? Thanks.