So I was following a Railscast and I noticed that inside of the html.erb
file the ruby
code has a faint background highlight effect to differentiate it from the rest of the HTML document.
I realize Ryan uses TextMate. I am using Sublime Text 3. How can I achieve the same effect? Thanks!
Sublime Text can use both . sublime-syntax and . tmLanguage files for syntax highlighting.
erb" that means it's an HTML file with ruby code embedded in it and it is similar to ". rhtml" extension of rails file.
To enable Syntax Highlighting click on “View” in the top bar, then hover your mouse over “Syntax”, and select your programming language from the list. Alternatively, if you save a document with a supported file extension, Sublime Text 3 will automatically apply the Syntax Highlighting for that language.
Install the ERB package for Sublime Text.
Assuming you have the Sublime Text package manager installed*, just hit cmd+shift+P
to get the command menu, than type install package
and select
Package Control: Install Package
to get the package manager menu.
In that menu, type ERB
and select the package when you see it. That's it!
*Here's how to install the package manager.
NB: Once installed, you'll need to make sure HTML (Rails) mode is set.
And here's what the coloring should look like (with Sublime Text's Twilight color scheme):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With