Skip to content

Instantly share code, notes, and snippets.

@kriswill
Created May 11, 2012 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kriswill/2662292 to your computer and use it in GitHub Desktop.
Save kriswill/2662292 to your computer and use it in GitHub Desktop.
Smarty textmate syntax file, modified to work with SublimeText 2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>tpl</string>
<string>html</string>
</array>
<key>foldingStartMarker</key>
<string>(&lt;(?i:(block|head|table|tr|div|style|script|ul|ol|form|dl|h1|h2|ul|ol|li))\b.*?&gt;|\{\{?(if|foreach|capture|literal|foreach|php|section|strip)|\{\s*$)</string>
<key>foldingStopMarker</key>
<string>(&lt;/(?i:(block|head|table|tr|div|style|script|ul|ol|form|dl|h1|h2|ul|ol|li))&gt;|\{\{?/(if|foreach|capture|literal|foreach|php|section|strip)|(^|\s)\})</string>
<key>name</key>
<string>Smarty</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>(?&lt;=\{)\*</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.smarty</string>
</dict>
</dict>
<key>end</key>
<string>\*(?=\})</string>
<key>name</key>
<string>comment.block.smarty</string>
</dict>
<dict>
<key>match</key>
<string>\b(if|else|elseif|foreach|foreachelse|section)\b</string>
<key>name</key>
<string>keyword.control.smarty</string>
</dict>
<dict>
<key>match</key>
<string>\b(block|extends|function|capture|config_load|counter|cycle|debug|eval|fetch|include_php|include|insert|literal|math|strip|rdelim|ldelim|assign|html_[a-z_]*)\b</string>
<key>name</key>
<string>support.function.built-in.smarty</string>
</dict>
<dict>
<key>match</key>
<string>\b(and|or)\b</string>
<key>name</key>
<string>keyword.operator.smarty</string>
</dict>
<dict>
<key>match</key>
<string>\b(eq|neq|gt|lt|gte|lte|is|not|even|odd|not|mod|div|by)\b</string>
<key>name</key>
<string>keyword.operator.other.smarty</string>
</dict>
<dict>
<key>match</key>
<string>\|(capitalize|cat|count_characters|count_paragraphs|count_sentences|count_words|date_format|default|escape|indent|lower|nl2br|regex_replace|replace|spacify|string_format|strip_tags|strip|truncate|upper|wordwrap)</string>
<key>name</key>
<string>support.function.variable-modifier.smarty</string>
</dict>
<dict>
<key>match</key>
<string>\b[a-zA-Z]+=</string>
<key>name</key>
<string>meta.attribute.smarty</string>
</dict>
<dict>
<key>begin</key>
<string>'</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.smarty</string>
</dict>
</dict>
<key>end</key>
<string>'</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.smarty</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.single.smarty</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\.</string>
<key>name</key>
<string>constant.character.escape.smarty</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.smarty</string>
</dict>
</dict>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.smarty</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.smarty</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\.</string>
<key>name</key>
<string>constant.character.escape.smarty</string>
</dict>
</array>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.variable.smarty</string>
</dict>
</dict>
<key>match</key>
<string>\b(\$)Smarty\.</string>
<key>name</key>
<string>variable.other.global.smarty</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.variable.smarty</string>
</dict>
</dict>
<key>match</key>
<string>(\$)[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*?\b</string>
<key>name</key>
<string>variable.other.smarty</string>
</dict>
<dict>
<key>match</key>
<string>\b(TRUE|FALSE|true|false)\b</string>
<key>name</key>
<string>constant.language.smarty</string>
</dict>
</array>
<key>scopeName</key>
<string>source.smarty</string>
<key>uuid</key>
<string>4D6BBA54-E3FC-4296-9CA1-662B2AD537C6</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment