How to add string interpolation highlighting for Sublime

To add general string interpolation highlighting for Sublime Text 2, you need to edit your .tmTheme file. It can be found in your SublimeText 2, go to Preferences, then Browse Packages. This will open up your finder or Windows Explorer. Look for the folder “Color Scheme – Default”, you should be able to find themes like Monokai and others inside.

In order to add the syntax highlight for CoffeeScript #{} in strings, for example:

[code language=”coffeescript”]c.url("#{vhaAppAddress}saaa", done)[/code]

Open up your .tmTheme file and add the following lines:

[code language=”xml”]
<dict>
<key>name</key>
<string>Embedded Source</string>
<key>scope</key>
<string>string source, text source</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string></string>
<key>foreground</key>
<string>#9bca3c</string>
<key>background</key>
<string>#444</string>
</dict>
</dict>
[/code]

You can change the colors of background and foreground to your liking too. Hope you’ll find this useful!

Leave a Reply

Your email address will not be published. Required fields are marked *