ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

PHP-Twig

by uhnomoli ALL Missing

A TextMate (and Sublime Text) bundle for Twig.

Details

  • 2016.09.06.03.08.54
  • github.​com
  • github.​com
  • 8 years ago
  • 2 years ago
  • 12 years ago

Installs

  • Total 124K
  • Win 53K
  • Mac 41K
  • Linux 30K
Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

PHP Twig tmBundle

A TextMate (and Sublime Text) bundle for Twig.

Thanks

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.

Notes

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.

Installation

TextMate, and most editors that support TextMate bundles, allow the installation of bundles simply by extracting an archive or cloning the repository into the application's bundle directory. This bundle is no different. Below is a list of common bundle directories.

Sublime Text

To install this bundle in Sublime Text, a few extra steps are required.

  1. Open Sublime Text and in the Preferences menu click Browse Packages.
  2. In the directory that was just opened, create a new directory PHP-Twig/.
  3. Move the contents of the Preferences/, Snippets/, and Syntaxes/ directories of this repo into the directory you just created.
  4. Restart Sublime Text.

TextMate

/Library/Application Support/TextMate/Bundles

TextMate 2

You can install this bundle in TextMate 2 by opening the preferences and going to the bundles tab. After installation it will be automatically updated for you.

Scopes

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
    Bitwise:       keyword.operator.bitwise.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