To add Ruby 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 Ruby’s ${} in strings, for example:

[code language=“ruby”]puts “Working in #{pwd}”[/code]

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

[code language=“xml”]

name

Embedded Ruby Punctuation

scope

string punctuation.section.embedded.ruby

settings

foreground

#75715E

background

#444444

name

Embedded Ruby Source

scope

string source.ruby.embedded.source

settings

foreground

#FFFBF7

background

#444444

[/code]

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

comments powered by Disqus