views:

394

answers:

2

Xcode's syntax colouring is poor at best and textmate's looks great, but I like Xcode, since I program in C++, too. I'd like to keep everything in one place and take advantage of other Xcode features.

Has anyone already done this or is there an easy way to do it?

+2  A: 

Xcode can do custom syntax coloring, you need two files

  • pbfilespec: specifies MIME type, extension and some meta info
  • xclangspec: which holds identifiers etc. that need colouring

and put them somewhere in ~/Library/Application Support/..

I'm a Textmate user myself, so don't know if such a thing exists for ruby, and neither a more exact specification for those files, but examples for other languages can easily be found.

Pieter
Xcode does have native syntax highlighting for Ruby, though it isn't as thorough as it is for C, Java or JavaScript. TextMate seems to have the best coverage of all.
tadman
A: 

After some googling, it looks like there is indeed some support for ERB files in XCode. It's a little hidden, though.

Check this page out: ERB Highlighting. In brief, XCode is looking for .rhtml files instead of .erb files, so .erb files don't trigger the ERB syntax highlighting. The solution, then, is to go open

/Developer/Library/PrivateFrameworks/DevToolsCore.framework/Versions/A/Resources/Standard file types.pbfilespec

look for the mapping for rhtml:

Extensions = (shtml, jsp, rhtml);

And add erb to the list:

Extensions = (shtml, jsp, rhtml, erb);

Viola! Just restart XCode and you'll get erb syntax highlighting. There's probably a way to do it from within XCode itself, but I haven't found it yet.

Omar Zakaria