Skip to content

Instantly share code, notes, and snippets.

@rossluebe
Created May 7, 2014 20:09
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rossluebe/f9015a1313d84b9604b8 to your computer and use it in GitHub Desktop.
Save rossluebe/f9015a1313d84b9604b8 to your computer and use it in GitHub Desktop.
Twig Snippets for Atom
'.text.html.twig':
'Tag Print':
'prefix': '}}'
'body': '{{ $1 }}$0'
'Tag Block':
'prefix': '%%'
'body': '{% $1$2 %}$0{% end$1 %}'
'Tag Block (Block)':
'prefix': '%%'
'body': '{% $1$2 %}\n $0\n{% end$1 %}'
'Tag Comment':
'prefix': '##'
'body': '{# $1 #}$0'
'Dump':
'prefix': 'dump'
'body': '{{ dump( $1 ) }}$0'
'Extends':
'prefix': 'extends'
'body': '{% extends \'${1:template}\' %}$0'
'Includes':
'prefix': 'inc'
'body': '{% include \'${1:template}\' ${2:with ${3:vars}${4: only}} %}$0'
'Set':
'prefix': 'set'
'body': '{% set ${1:var} = ${2:value} %}$0'
'Set (Block)':
'prefix': 'setb'
'body': '{% set ${1:var} %}\n $0\n{% endset %}'
'Block':
'prefix': 'block'
'body': '{% block ${1:name} %}$0{% endblock %}'
'Block (Block)':
'prefix': 'blockb'
'body': '{% block ${1:name} %}\n $0\n{% endblock %}'
'Filter':
'prefix': 'filter'
'body': '{% filter ${1:name} %}$0{% endfilter %}'
'Filter (Block)':
'prefix': 'filterb'
'body': '{% filter ${1:name} %}\n $0\n{% endfilter %}'
'If':
'prefix': 'if'
'body': '{% if ${1:condition} %}$0{% endif %}'
'If (Block)':
'prefix': 'ifb'
'body': '{% if ${1:condition} %}\n $0\n{% endif %}'
'If':
'prefix': 'ife'
'body': '{% if ${1:condition} %}\n $2\n{% else %}\n $0\n{% endif %}'
'For':
'prefix': 'for'
'body': '{% for ${1:item} in ${2:seq} %}\n $0\n{% endfor %}'
'For Else':
'prefix': 'fore'
'body': '{% for ${1:item} in ${2:seq} %}\n $3\n{% else %}\n $0\n{% endfor %}'
'Else':
'prefix': 'else'
'body': '{% else %}\n $0'
'Filter':
'prefix': 'filter'
'body': '{% filter ${1:name} %}$0{% endfilter %}'
'Filter (Block)':
'prefix': 'filterb'
'body': '{% filter ${1:name} %}\n $0\n{% endfilter %}'
@robertpetras
Copy link

Thank you for this great collection of Twig snippets for Atom Editor! 👍

@kovtunos
Copy link

kovtunos commented Dec 7, 2016

Thanks, man. I was writing my own Twig snippets when came across your collection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment