4

I'm trying to configure Sublime Text 2 to open up *.handlebars.coffee files using HTML syntax highlighting as a default. I know that I can change the default syntax highlighting for all .coffee files, but is there a way to change the defaults for a file with two extensions?

I've seen this similar post but this does not quite answer my question: Set default syntax to different filetype in Sublime Text 2

Community
  • 1
  • 1
Will Hitchcock
  • 4,648
  • 3
  • 22
  • 32

1 Answers1

7

You can add handlebars.coffee to the fileTypes array in HTML.tmLanguage. After I did that, Sublime opened an example handlebars.coffee file as html syntax. Here's the relevant lines from my HTML.tmLanguage file:

<key>fileTypes</key>
<array>
    <string>handlebars.coffee</string>
    <string>html</string>
    <string>htm</string>
    etc.
</array>

You can access this file by opening the HTML folder under preferences > browse packages...

Make sure to save a new version of this file in your User preference folder. This will retain it through updates.

dbn
  • 13,144
  • 3
  • 60
  • 86
  • I tried this with coffee.haml and this did not work - perhaps because a haml package already exists and beats this to the punch? – Ian Warner Aug 02 '13 at 10:00