A TextMate (and Sublime Text) bundle for Twig.
I'd like to thank a few people that have helped me out with the creation of this bundle.
- taavi for fixing a bug stopping the bundle from actually working in TextMate.
- DuoSRX for contributing a bunch of snippets.
- Infininight in ##textmate[freenode] for helping me a ton with the rewrite.
This is my first tmbundle and it was made and tested in Sublime Text. Everything should work fine, but if something doesn't please report it and I'll do my best to get it fixed.
I'm also not extremely familiar with TextMate's method of creating language syntaxes. If anyone has any input on optimizing it or on anything else, such as choices in grammar scopes, please feel free to let me know.
To aid theming, here's a list of what each Twig element is scoped to.
Tags:
{{ }}:
Tag: punctuation.section.tag.twig
Scope: meta.tag.template.value.twig
{% %}:
Tag: punctuation.section.tag.twig
Scope: meta.tag.template.block.twig
{# #}: comment.block.twig
Embedded:
{{ }}: meta.tag.inline.any.html meta.tag.template.value.twig
{% %}: meta.tag.inline.any.html meta.tag.template.block.twig
Constants:
Language: constant.language.twig
Numeric: constant.numeric.twig
Operators:
Arithmetic: keyword.operator.arithmetic.twig
Assignment: keyword.operator.assignment.twig
Comparison: keyword.operator.comparison.twig
Logical: keyword.operator.logical.twig
Other: keyword.operator.other.twig
Objects: variable.other.twig
Properties: variable.other.property.twig
Accessors:
Dot: punctuation.separator.property.twig
Array:
Begin: punctuation.section.array.begin.twig
End: punctuation.section.array.end.twig
Strings:
Single: string.quoted.single.twig
Double: string.quoted.double.twig
Arrays: meta.array.twig
Accessor:
Begin: punctuation.section.array.begin.twig
End: punctuation.section.array.end.twig
Separator: punctuation.separator.object.twig
Hashes: meta.hash.twig
Accessor:
Begin: punctuation.section.hash.begin.twig
End: punctuation.section.hash.end.twig
Separator: punctuation.separator.object.twig
Keys: punctuation.separator.key-value.twig
Keywords: keyword.control.twig
Functions: support.function.twig
Parens:
Begin: punctuation.definition.parameters.begin.twig
End: punctuation.definition.parameters.end.twig
Arguments: meta.function.arguments.twig
Filters: support.function.twig
Parens:
Begin: punctuation.definition.parameters.begin.twig
End: punctuation.definition.parameters.end.twig
Arguments: meta.function.arguments.twig
User-Defined: meta.function-call.other.twig
Macros: meta.function-call.twig
I included a few additional things in /Extras
. There is a screenshot (same one as displayed below) of the bundle in it's current state, as well as the 3 themes I'm maintaining that were updated to better accompany this bundle.