Adding HTML Twig syntax highlighting to Sublime text 3

Out of the box Sublime Text 3 does not colour HTML Twig syntax correctly.
At the point of writing this there doesn’t seem to be anything on Package Control that can do this.


To add correct syntax highlighting create a folder named “PHP-Twig” in


~/Library/Application Support/Sublime Text 3/Packages/


Sublime Text > Preferences >Browse Packages will open the Packages directory in Explorer.

Copy this .tmLanguage file on Github to the PHP-Twig directory you just created.

Open Sublime Text 3 and you should now have “HTML (Twig)” available in the file format choice menu at the bottom right of the window

Now your code looks nice.




Was this article helpful?