32

Does anybody know a good text editor for Mac that supports syntax highlighting in CoffeeScript? Is it possible to do this in TextWrangler or BBEdit?

Cheers :)

8 Answers 8

41

On http://jashkenas.github.com/coffee-script/ there is a list of what is available.

For Emacs there is CoffeeScript Major Mode (Emacs for mac: http://aquamacs.org/)

For Vim there is Vim CoffeeScript (Vim for mac: http://code.google.com/p/macvim/)

For Textmate there is CoffeeScript TextMate Bundle (how noted by Trevor, this is maintained by CoffeeScript creator Jeremy Ashkenas. And how noted by Chocohound, it works on Sublime Text 2 too)

For Gedit there is gedit-coffeescript

For IntelliJ IDEA and RubyMine there is coffeescript-idea

I can find nothing for TextWrangler or BBEdit.

Edit:

The list moved to the wiki and now there is an attempt to make a BBEdit plugin too ;)

As mb21 said, you can find TextWrangler instructions here.

5
  • 3
    You can install Gedit on a mac too ;) projects.gnome.org/gedit/screenshots.html
    – Sinetris
    Commented Nov 22, 2010 at 15:24
  • 2
    It should be noted that the bundle for TextMate is maintained by CoffeeScript creator Jeremy Ashkenas, so it's the closest thing to an "official" bundle. Commented Feb 3, 2011 at 20:05
  • Sublime Text 2 works well, and can use the tmLanguage and tmPreferences files from Jeremy Ashkenas. See sublimetext.com/forum/viewtopic.php?f=4&t=2022&start=10
    – Nils
    Commented Dec 23, 2011 at 17:44
  • I use the vim plugin. It's far more awesome than I expected: it auto-compiles the coffeescript into javascript every time I save from vim. And if there are any errors, it opens them up in a window. Amazing!
    – Unoti
    Commented Feb 9, 2012 at 2:43
  • 2
    You can add it to TextWrangler: joyofmodeling.org/index.php/OSX/…
    – mb21
    Commented May 15, 2012 at 9:41
9

To highlight coffeescript in Eclipse:

  1. Download http://www.gstaff.org/colorEditor/cbg.editor_1.2.6.jar
  2. Download https://raw.github.com/dhotson/coffeescript-jedit/master/coffeescript.xml
  3. Open cbg.editor_1.2.6.jar with a zip editor.
  4. Put coffeescript.xml into the cbg.editor_1.2.6.jar\modes directory
  5. Edit cbg.editor_1.2.6.jar\modes\catalog (it's an XML file)
  6. Add a line for Coffeescript:

<MODE NAME="coffee" FILE="coffeescript.xml" FILE_NAME_GLOB="*.coffee" />

Save the .jar and put it into Eclipse's plugin directory. Restart Eclipse and .coffee files should now be highlighted.

WARNING: For some reason, this plugin's default colours are TERRIFYINGLY UNUSABLE. I recommend editing the colours to the attached first, before viewing any files. Honestly, just save yourself the heartache.

Colour preferences in Eclipse

3
  • 3
    I wrote a script that automates downloading and modifying the jar as you describe. It includes some additional steps that I found helpful. Feel free to edit it to suit your own needs: github.com/bolinfest/coffee-script/blob/master/…
    – bolinfest
    Commented Jul 8, 2011 at 16:43
  • bash < <(curl https://raw.github.com/bolinfest/coffee-script/master/patch-color-editor.sh)
    – pwnall
    Commented Aug 11, 2011 at 4:59
  • @bolinfest: I'm on Mac and I haven't installed wget command, infact launching your script I get patch-color-editor.sh: line 18: wget: command not found. To get it works you have to save the script replacing wget command with curl -O.
    – Fred K
    Commented Oct 23, 2013 at 11:00
7

TextMate have good bundle:

TextMate bundle

RubyMine / IDEA have also good plugin (but this is IDE and is crossplatform):

Idea plugin

2
  • Most always there's a TextMate bundle for anything you'd want to accomplish. Commented Nov 22, 2010 at 14:11
  • Thanks, Andrzej. I guess I will finally have to learn to like TextMate :)
    – kolinko
    Commented Nov 22, 2010 at 18:35
6

Espresso 2 has CoffeeScript.sugar

1

Aptana has it now in version 3.0.4, but due to a bug with control over tabs/spaces, you'll need to install the 3.0.5 beta.

This is the beta Eclipse update site: http://preview.appcelerator.com/aptana/studio3/plugin/update/beta/

I'm pretty happy with Aptana. In my opinion, the editors for css, scss, coffeescript, html, etc. are all better than the built-in eclipse editors for these languages.

1

Adobe Brackets has native CoffeeScript support and the 'Interactive Linter' extension (downloadable from within the app) will even lint it to some extent, tell you that your lines are too long and so on.

However, there is no comment/uncomment keyboard shortcut, which gets old fast and there are other bugs, as you'd expect with software in such hard-development.

Worth checking out, none-the-less.

0

Did you give Eclipse a try?

3
  • where have you found eclipse support for coffeescript?
    – Guard
    Commented Dec 30, 2010 at 9:51
  • @GUARD - i think you should be able to configure eclipse to format CoffeeScript as desired
    – Thariama
    Commented Jan 3, 2011 at 11:18
  • 3
    I was able to get Coffeescript syntax coloring in Eclipse using the Color Editor plugin and the jEdit coffeescript.xml mode available. Contact me for details if you like. Commented Feb 12, 2011 at 2:04
0

Here's a plist file for syntax highlighting, etc, for CoffeeScript in BBEdit:

https://gist.github.com/3219871

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.