X
    Categories: General

Twig extension for sublime text

Twig extension for sublime text

Lets see how to install twig extension in sublime text 3, Recently I have start working on sublime text. And using twig extension for my laravel project.
Normally sublime text3 does not have syntax highlighter for twig extension we need to install it manually.
Goto View -> Syntax => You can see the all extensions which has already in sublime text.

There is 2 ways to use

1. Goto View -> Syntax -> Open All with current extensions as -> [Select the extension => It will open all the files with selected extenstions]

2. Installing Twig Extension for sublime text

Step 1 :

Goto your sublime package folder

If you are using Sublime text 2

$ cd ~/.config/sublime-text-2/Packages/

For Sublime Text 3

$ cd /Users/YOURUSERNAME/Library/Application\ Support/Sublime\ Text\ 3/Packages
Step 2 :

Clone Twig Package to your Sublime folder

$ git clone https://github.com/Anomareh/PHP-Twig.tmbundle.git PHP-Twig
Step 3 :

Move Twig Package

$ mv PHP-Twig/Syntaxes/* PHP-Twig/
Step 4 :

Restart your Sublime Text

Step 5 :

Choose TWIG extension


Goto “View->Syntax->HTML (Twig)”

To automatically highlight all twig files, open any html.twig template and select

“View->Syntax->Open all current extension as…->HTML (Twig)”.

Thats it Now you can see your twig extensions code has highlighted.

We can change the options like fonts, line height, themes etc in sublime text

Goto Preferences -> Settings -> Write like below

{

"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme",
"font_face": "Ubuntu Mono",
"font_size": 14.5,
"ignored_packages":
[
"Vintage"
],
"line_padding_bottom": 3,
"line_padding_top": 3,
"word_wrap": true,
}


Thanks for reading. If you like this article don’t forget to share and comment.
Happy Coding!..

Marimuthu: