Add Twig syntax highlight in Sublime Text 2

  1. Select the “Preferences->Browse Packages…” menu to open the folder that contains Sublime Text 2 packages.
  2. Download the Anomareh/PHP-Twig.tmbundle repository contents to a folder called PHP-Twig inside that packages folder.
  3. Move all the files inside PHP-Twig/Syntaxes folder to the PHP-Twig root folder.
  4. Restart Sublime Text 2.

You can also use the terminal to do this using git:

$ cd ~/.config/sublime-text-2/Packages/
$ git clone https://github.com/Anomareh/PHP-Twig.tmbundle.git PHP-Twig
$ mv PHP-Twig/Syntaxes/* PHP-Twig/

Once restarted you’ll see a new option called “HTML (Twig)” in “View->Syntax” menu. To automaticaly highlight files with html.twig extension just open one of them and select “View->Syntax->Open all current extension as…->HTML (Twig)”.

HTML-Twig-Sublime-Text-2

You might also like

Use Sublime Text 2 to beautify HTML, CSS and JavaScript
First of all you have to install Package Control in Sublime Text 2 as I explained before. Then install...

Use Sublime Text 2 to beautify HTML, CSS and JavaScript
First of all you have to install Package Control in Sublime Text 2 as I explained before. Then install...

Open a file in Sublime Text 2 from command line
The idea is to create a symbolic link to the Sublime Text's executable and put in the system's path (execute...

Easely add plugins to Sublime Text 2
Download Sublime Text 2 (at this moment the lastest build is 2181) and install it:Mac Windows 32...

  1. Here is one more very good editor for Twig: http://codelobster.com/twig.html

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.