Sublime Forum

Is there a Smarty plugin for Sublime Text?


Is there a plugin that would enable Sublime Text to provide syntax highlighting for the Smarty templating language? I’ve looked in the ‘Sublime Text Community Packages’ but not found anything.

Previously, I was using Notepad++, with the optional ‘user defined language’ file for Smarty, to achieve this. Also, Komodo Edit provides this facility ‘out of the box’.

Thanks in anticipation for any advice.



In general, you can use TextMate syntax highlighting files: the one for Smarty is at … /Syntaxes/ - you’ll need to save the file under Sublime Text’s Packages/ directory (you can access this via ‘Preferences/Browse Packages…’), and rename it such that it has an extension of ‘.tmLanguage’



I’ve followed these instructions and I can’t this to work. Does anyone have smarty working well in their editor?




You need to do more than just installing it. You need to edit HTML.tmLanguage.

Uncomment lines 543-546, 712-753, and lastly change the value of line 739 to 0.



I was going to start a thread to provide some instructions on how I enabled Smarty language.

Here is:

1- With Sublime Text 2 default installation
2 - Open file “Packages\HTML\HTML.tmLanguage”, if you search for string “<!–” you will notice that (currently) there is two references to “Smarty language” commented. Un-comment these.
3 - Download this file “” as file “Packages\User\Smarty.tmLanguage”
4 - Default “colour-scheme” may not high-lite the syntax properly but “twilight” do. Preferences -> Colour Scheme -> Twilight



Hi tito and sublime users,

thank you very much for your smarty-instructions!

Unfortunateley, this method doesn’t seem to work with the latest release (Sublime Text 2 Build 2165).

Ok, the Language-packs are now ending on “.sublime-package”.
I renamed the smarty.tmLanguage to Smarty.sublime-package in the /User directory but Sublime keeps displaying an error message on startup. (I also tried to place it in the root directory of /packages)

Of course, I uncommented the smarty-instructions in the HTML.sublime-package.

Does anybody know how to get smarty highlighting work with the current release of Sublime 2?

Would be very grateful!

Best Regards




ahh sorry guys, it works perfect with titos instructions!!

I’ve been searching in the Sublime Program directory all the time, not in the user/AppData directory which was meant… hehe :blush:

Best Regards




titos guide worked for me also perfectly!
i have the newest version of sublime text 2 (Build 2183)



Hi guys,

thanks for those tricks to get smarty support running.

Now my question is:
Is there an easy way to give the “smarty tags” a different color then the “html tags”?

I feel like color-wise I would like the to totally stand out in an html document… right now they look like html tags to me…

any ideas? I am using the Monokai theme…

Thanks for your support



Not working for me. I followed Tito’s instructions. I’m using build 2181 and my OS is Windows 7 - 64 bit



I have a small issue with this smarty plugin, quotes (single and double) printed outside smarty tags are interpreted as start of string.
Meaning if I have “hasn’t” as a string in html, or even a html-comment, the rest of the file will be interpreted as being in a string.

I’m hoping this could be changed by tweaking a regexp or two in the settings-file, but before I try to understand how they work on my own, does anyone else know?



This method works for me, but unfortunately the emmet plugin doesn’t work if I use smarty syntax highligher. Any suggestion?

Another question about this, if I want to limit the scope of snippets to html and tpl files what I should use as scope? I’ve tried source.tpl and text.tpl, but It seems it’s not the right choice :smile:

Thank you



If you already a Smarty.tmLanguage or Smarty.sublime-package (in AppData\Roaming\Sublime Text 2\Packages\Smarty\Syntaxes for example) you can still follow Tito’s steps but at step 3. file no need to download textmate’s Smarty.plist.
You can use yours just by giving your Smarty.tmLanguage scopeName found at the end of the file.
for me it was


and copy it in place of source.smarty so

<array> <dict> <key>include</key> <string>source.smarty</string> </dict> </array>

<array> <dict> <key>include</key> <string>text.html.smarty</string> </dict> </array>

and that should do it