Add Twig syntax highlighting to Sublime Text 2 or 3

I've been working with Twig lately. Although I use PhPStorm as my main IDE, I try to keep Sublime text as fully loaded as PHPStorm using packages. Unlike PHPStorm, Sublime text doesn't have highlighting for Twig templates built-in. There is a package for that, except I couldn't get it working through Package control. To install the package manually follow these steps. 

For Sublime text 2: 
$ cd ~/.config/sublime-text-2/Packages/

For Sublime text 3: 
$ cd /Users/YOURUSERNAME/Library/Application\ Support/Sublime\ Text\ 3/Packages

$ git clone https://github.com/Anomareh/PHP-Twig.tmbundle.git PHP-Twig
$ mv PHP-Twig/Syntaxes/* PHP-Twig/

After restarting Sublime Text choose the option called “HTML (Twig)” in “View->Syntax” menu to see the new highlighting.

To automatically highlight all twig files, open any html.twig template and select
“View->Syntax->Open all current extension as…->HTML (Twig)”.

Add new comment