Reputation: 9913
I want to know how can I have highlighting syntax for TWIG in Sublime Text.
Actually when I open a TWIG file all fonctions and conditions are similar (white on black) :
Upvotes: 53
Views: 43767
Reputation: 9913
Syntax highlighting and auto-completion for Twig in Sublime Text 2
is possible with : PHP-Twig.tmbundle
You can clone the project with :
git clone https://github.com/Anomareh/PHP-Twig.tmbundle.git
Or download it directly from the Github (last master version) :
https://github.com/Anomareh/PHP-Twig.tmbundle/archive/master.zip
To install this bundle in Sublime Text, a few extra steps are required.
PHP-Twig/
.PHP-Twig/Syntaxes/
directory to PHP-Twig/
To apply syntax highlighting on your Twig HTML files :
.html.twig
fileThat’s it. It should work by now.
Upvotes: 110
Reputation: 918
I'm working on Ubuntu, I have solved the problem by downloading https://github.com/Anomareh/PHP-Twig.tmbundle/archive/master.zip and I have done what was wrote inside ReadMe file.
Upvotes: 2
Reputation: 750
You can also install PHP-Twig.tmbundle through Sublime Text's Package Control.
With Package Control installed:
It will install the same version of @antoine-subit's answer, and will automatically use the correct syntax for any Twig file you open
Upvotes: 47
Reputation: 139
If you're not used to Sublime, don't forget to click on the bottom right of the sublime window (a drop up/down should appear) and then select "HTML (Twig)" from the list of languages in order to enable the package!
Upvotes: 13