Adding CoffeeScript highlighting to Sublime Text 2

by Kasper Tidemann

If you use Sublime Text 2 on Mac OS X and write a lot of CoffeeScript, chances are you’re yearning for CoffeeScript highlighting. It’s not a default part of the 2181 build (the current build), so you have to add it yourself. This is what you need to do:

  1. Download the CoffeeScript.tmLanguage file
  2. Download the CoffeeScript.tmPreferences file

With those two files downloaded, you now need to access your local library at ~/Library/Application Support/Sublime Text 2/Packages/. Since the folder is hidden by default in Finder, you can go ahead and boot up your Terminal. Type in the following commands:

cd ~/Library/Application Support/Sublime Text 2/Packages/
mkdir CoffeeScript
cd CoffeeScript
open .

The open . command will open the current folder in a Finder window. Now, copy the CoffeeScript.tmLanguage and CoffeeScript.tmPreferences to the ~/Library/Application Support/Sublime Text 2/Packages/CoffeeScript folder, restart Sublime Text 2 – and you’re good to go!

Please note that any .coffee files you may have previously opened in Sublime Text 2 may need to be set to use the CoffeeScript highlighter explicitly. To do that, click the “Plain text” text in the bottom right corner and select CoffeeScript.