Fresh Blurbs

Espresso And Syntax Highlights for Custom File Formats

I like Espresso from MacRabbit for server-side scripting a lot. The latest version (2.0) has merged a wonderful code editor with the best-of-the-class CSS editor, giving one awesome, unified experience. And, of course, you can edit your files directly over an SSH connection (the latter, alas, is not as straightforward as it is in Panic's Coda, but, well, we love both of them for different reasons).

Nothing in this life is perfect, however. One glaring shortcoming of Espresso is: no UI for assigning a syntax highlighter to custom file extensions. Espresso recognizes most common file extensions, but if you do something slightly different, e.g.: use .tpl files in Drupal (which are PHP files) or use Handlebars templates in Javascript (which are basically HTML), you won't get default syntax highlighting because Espresso does not know what type of files these are.

Let's see how we can teach Espresso custom file types. I will do this for .handlebars files, which are template files I use for my Javascript coding.

  1. Right-click on in Finder and select: "show package contents".
  2. Go to folder: Contents > SharedSupport > Sugars
  3. Right-clic on "XML-and-HTML.sugar" and select: "show package contents".
  4. Open Languages.xml for editing (with vi, Textmate or whatever your favorite text editor is)
  5. Scroll down to detectors section which should read something like:\

  6. Add more extensions to the section, e.g. for handlebars, I added:\

  7. Save languages.xml and restart Espresso

comments powered by Disqus