├── .gitignore ├── url.sublime-snippet ├── debug.sublime-snippet ├── ext.sublime-snippet ├── load.sublime-snippet ├── now.sublime-snippet ├── cycle.sublime-snippet ├── inc.sublime-snippet ├── super.sublime-snippet ├── firstof.sublime-snippet ├── ssi.sublime-snippet ├── context_variable.sublime-snippet ├── extends.sublime-snippet ├── csrf_token.sublime-snippet ├── include.sublime-snippet ├── generic_template_tag.sublime-snippet ├── regroup.sublime-snippet ├── templatetag.sublime-snippet ├── trans.sublime-snippet ├── if.sublime-snippet ├── for.sublime-snippet ├── with.sublime-snippet ├── comment.sublime-snippet ├── filter.sublime-snippet ├── ifeq.sublime-snippet ├── widthratio.sublime-snippet ├── ife.sublime-snippet ├── ifequal.sublime-snippet ├── spaceless.sublime-snippet ├── ifchanged.sublime-snippet ├── ifelse.sublime-snippet ├── autoescape.sublime-snippet ├── block.sublime-snippet ├── fore.sublime-snippet ├── ifnotequal.sublime-snippet ├── extrahead.sublime-snippet ├── extrastyle.sublime-snippet ├── blocktrans.sublime-snippet ├── README.rst └── HTML (Django).tmLanguage /.gitignore: -------------------------------------------------------------------------------- 1 | *.cache -------------------------------------------------------------------------------- /url.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | url 5 | text.html.django 6 | url 7 | -------------------------------------------------------------------------------- /debug.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | debug 5 | text.html.debug 6 | debug 7 | -------------------------------------------------------------------------------- /ext.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ext 5 | text.html.django 6 | ext 7 | -------------------------------------------------------------------------------- /load.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | load 5 | text.html.django 6 | load 7 | -------------------------------------------------------------------------------- /now.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | now 5 | text.html.django 6 | now 7 | -------------------------------------------------------------------------------- /cycle.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | cycle 5 | text.html.django 6 | cycle 7 | -------------------------------------------------------------------------------- /inc.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | inc 5 | text.html.django 6 | inc 7 | -------------------------------------------------------------------------------- /super.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | super 5 | text.html.django 6 | super 7 | -------------------------------------------------------------------------------- /firstof.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | firstof 5 | text.html.django 6 | firstof 7 | -------------------------------------------------------------------------------- /ssi.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ssi 5 | text.html.django 6 | ssi 7 | -------------------------------------------------------------------------------- /context_variable.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | { 5 | text.html.django 6 | context variable 7 | -------------------------------------------------------------------------------- /extends.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | extends 5 | text.html.django 6 | extends 7 | -------------------------------------------------------------------------------- /csrf_token.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | csrf_token 5 | text.html.django 6 | csrf_token 7 | -------------------------------------------------------------------------------- /include.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | include 5 | text.html.django 6 | include 7 | -------------------------------------------------------------------------------- /generic_template_tag.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | % 5 | text.html.django 6 | generic template tag 7 | -------------------------------------------------------------------------------- /regroup.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | regroup 5 | text.html.django 6 | regroup 7 | -------------------------------------------------------------------------------- /templatetag.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | templatetag 5 | text.html.django 6 | templatetag 7 | -------------------------------------------------------------------------------- /trans.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | trans 5 | text.html.django 6 | trans 7 | -------------------------------------------------------------------------------- /if.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | if 9 | text.html.django 10 | if 11 | -------------------------------------------------------------------------------- /for.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | for 9 | text.html.django 10 | for 11 | -------------------------------------------------------------------------------- /with.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | with 9 | text.html.django 10 | with 11 | -------------------------------------------------------------------------------- /comment.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | comment 9 | text.html.django 10 | comment 11 | -------------------------------------------------------------------------------- /filter.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | filter 9 | text.html.django 10 | filter 11 | -------------------------------------------------------------------------------- /ifeq.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | ifeq 9 | text.html.django 10 | ifeq 11 | -------------------------------------------------------------------------------- /widthratio.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | widthratio 5 | text.html.django 6 | widthratio 7 | -------------------------------------------------------------------------------- /ife.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | ife 11 | text.html.django 12 | ife 13 | -------------------------------------------------------------------------------- /ifequal.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | ifequal 9 | text.html.django 10 | ifequal 11 | -------------------------------------------------------------------------------- /spaceless.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | spaceless 9 | text.html.django 10 | spaceless 11 | -------------------------------------------------------------------------------- /ifchanged.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | ifchanged 9 | text.html.django 10 | ifchanged 11 | -------------------------------------------------------------------------------- /ifelse.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | ifelse 11 | text.html.django 12 | ifelse 13 | -------------------------------------------------------------------------------- /autoescape.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | autoescape 9 | text.html.django 10 | autoescape 11 | -------------------------------------------------------------------------------- /block.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | block 9 | text.html.django 10 | block 11 | -------------------------------------------------------------------------------- /fore.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | fore 11 | text.html.django 12 | fore 13 | -------------------------------------------------------------------------------- /ifnotequal.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | ifnotequal 9 | text.html.django 10 | ifnotequal 11 | -------------------------------------------------------------------------------- /extrahead.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | extrahead 9 | text.html.django 10 | extrahead 11 | -------------------------------------------------------------------------------- /extrastyle.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | extrastyle 9 | text.html.django 10 | extrastyle 11 | -------------------------------------------------------------------------------- /blocktrans.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | blocktrans 9 | text.html.django 10 | blocktrans 11 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | =============================== 2 | Sublime Text 2 Django Snippets 3 | =============================== 4 | Overview 5 | -------- 6 | 7 | This is the first part of a set of snippets for 8 | `Sublime Text 2 `_ to use in Django 9 | templates. At the moment it includes snippets for all standard Django templates tags. 10 | 11 | Installation 12 | ------------ 13 | 14 | 1. Clone this repo 15 | 2. Put the contents of this repo directly inside: 16 | 17 | - OS X: ~/Library/Application Support/Sublime Text 2/Packages/HTML (Django)/ 18 | - Windows: %APPDATA%/Sublime Text 2/Packages/HTML (Django)/ 19 | - Linux: ~/.Sublime Text 2/Packages/HTML (Django)/ 20 | 21 | 3. Don't forget to turn on django mode View → Syntax → HTML (Django) 22 | 4. That's it, you can use the snippets now. 23 | 24 | Snippets list 25 | ------------- 26 | =============== ====================================================== 27 | Abbreviation Tag 28 | =============== ====================================================== 29 | autoescape ``{% autoescape %} {% autoescape %}`` 30 | block ``{% block %} {% endblock %}`` 31 | comment ``{% comment %} {% endcomment %}`` 32 | csrf_token ``{% csrf_token %}`` 33 | cycle ``{% cycle %}`` 34 | debug ``{% debug %}`` 35 | ext ``{% extends "" %}`` 36 | extends ``{% extends "" %}`` 37 | filter ``{% filter %} {% endfilter %}`` 38 | firstof ``{% firstof %}`` 39 | for ``{% for in %} {% endfor %}`` 40 | fore ``{% for in %} {% empty %} {% endfor %}`` 41 | if ``{% if %} {% endif %}`` 42 | ifchanged ``{% ifchanged %} {% endifchanged %}`` 43 | ife ``{% if %} {% else %} {% endif %}`` 44 | ifelse ``{% if %} {% else %} {% endif %}`` 45 | ifeq ``{% ifequal %} {% endifequal %}`` 46 | ifequal ``{% ifequal %} {% endifequal %}`` 47 | ifnotequal ``{% ifnotequal %} {% endifnotequal %}`` 48 | inc ``{% include %}`` 49 | include ``{% include %}`` 50 | load ``{% load %}`` 51 | now ``{% now "" %}`` 52 | regroup ``{% regroup by as %}`` 53 | spaceless ``{% spaceless %} {% endspaceless %}`` 54 | ssi ``{% ssi %}`` 55 | templatetag ``{% templatetag %}`` 56 | url ``{% url %}`` 57 | widthratio ``{% widthratio %}`` 58 | with ``{% with as %} {% endwith %}`` 59 | trans ``{% trans %}`` 60 | blocktrans ``{% blocktrans with as %} {% endblocktrans %}`` 61 | { ``{{ }}`` 62 | % ``{% %}`` 63 | =============== ====================================================== 64 | 65 | ...and some non-official stuff: 66 | 67 | =============== ====================================================== 68 | Abbreviation Tag 69 | =============== ====================================================== 70 | super ``{{ block.super }}`` 71 | extrahead ``{% block extrahead %} {% endblock extrahead %}`` 72 | extrastyle ``{% block extrastyle %} {% endblock extrastyle %}`` 73 | =============== ====================================================== 74 | 75 | 76 | Hints 77 | ----- 78 | 79 | You can use the *Tab* key to move the cursor to next logical position. For example use the ``for`` 80 | snippet and hit *Tab* to see how the cursor moves. -------------------------------------------------------------------------------- /HTML (Django).tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | foldingStartMarker 8 | (<(?i:(head|table|tr|div|style|script|ul|ol|form|dl))\b.*?>|{% (block|comment|filter|for|if|ifchanged|ifequal|ifnotequal)) 9 | foldingStopMarker 10 | (</(?i:(head|table|tr|div|style|script|ul|ol|form|dl))>|{% (endblock|endblocktrans|endcomment|endfilter|endfor|endif|endifchanged|endifequal|endifnotequal) %}) 11 | keyEquivalent 12 | ^~D 13 | name 14 | HTML (Django) 15 | patterns 16 | 17 | 18 | comment 19 | Since html is valid in Django templates include the html patterns 20 | include 21 | text.html.basic 22 | 23 | 24 | begin 25 | {% comment %} 26 | end 27 | {% endcomment %} 28 | name 29 | comment.block.django.template 30 | 31 | 32 | begin 33 | {# 34 | end 35 | #} 36 | name 37 | comment.line.django.template 38 | 39 | 40 | begin 41 | {{ 42 | end 43 | }} 44 | name 45 | variable.other.django.template 46 | 47 | 48 | begin 49 | ({%) 50 | captures 51 | 52 | 1 53 | 54 | name 55 | entity.other.django.tagbraces 56 | 57 | 58 | end 59 | (%}) 60 | name 61 | meta.scope.django.template.tag 62 | patterns 63 | 64 | 65 | match 66 | \b(autoescape|endautoescape|block|endblock|blocktrans|endblocktrans|plural|debug|extends|filter|firstof|for|endfor|if|include|else|endif|ifchanged|endifchanged|ifequal|endifequal|ifnotequal|endifnotequal|load|now|regroup|ssi|spaceless|templatetag|widthratio)\b 67 | name 68 | keyword.control.django.template 69 | 70 | 71 | match 72 | \b(and|or|not|in|by|as)\b 73 | name 74 | keyword.operator.django.template 75 | 76 | 77 | match 78 | \|(add|addslashes|capfirst|center|cut|date|default|default_if_none|dictsort|dictsortreversed|divisibleby|escape|filesizeformat|first|fix_ampersands|floatformat|get_digit|join|length|length_is|linebreaks|linebreaksbr|linenumbers|ljust|lower|make_list|phone2numeric|pluralize|pprint|random|removetags|rjust|safe|slice|slugify|stringformat|striptags|time|timesince|title|truncatewords|unordered_list|upper|urlencode|urlize|urlizetrunc|wordcount|wordwrap|yesno)\b 79 | name 80 | support.function.filter.django 81 | 82 | 83 | begin 84 | '|" 85 | end 86 | '|" 87 | name 88 | string.other.django.template.tag 89 | 90 | 91 | match 92 | [a-zA-Z_]+ 93 | name 94 | string.unquoted.django.template.tag 95 | 96 | 97 | 98 | 99 | scopeName 100 | text.html.django 101 | uuid 102 | F4B0A70C-ECF6-4660-BC26-785216E3CF02 103 | 104 | 105 | --------------------------------------------------------------------------------