Tag Archives: highlight

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