Skip to content

Instantly share code, notes, and snippets.

@xen
Last active July 5, 2018 05:36
Show Gist options
  • Save xen/d11451454820554cb61f20dcdad3a4b0 to your computer and use it in GitHub Desktop.
Save xen/d11451454820554cb61f20dcdad3a4b0 to your computer and use it in GitHub Desktop.
VS Code Jinja2 snippets
{
"i18n": {
"prefix": "_",
"body": [
"{{ _('${TM_SELECTED_TEXT:${1:text}}') }}"
],
"description": "i18n"
},
"gt": {
"prefix": "gt",
"body": [
"{{ gettext('${TM_SELECTED_TEXT:${1:text}}') }}"
],
"description": "Gettext"
},
"ngt": {
"prefix": "ngt",
"body": [
"{{ ngettext('${TM_SELECTED_TEXT:${1:text}}') }}"
],
"description": "Ngettext"
},
"block": {
"prefix": "block",
"body": "{% block ${1:name} %}\n\t$2\n{% endblock %}",
"description": "Block",
},
"{%": {
"prefix": "{%",
"body": "{% $0 %}",
"description": "Complete Block",
},
"{{": {
"prefix": "{{",
"body": "{{ $0 }}",
"description": "Complete Variable",
},
"{#": {
"prefix": "{#",
"body": "{# ${TM_SELECTED_TEXT:${1:text}} #}",
"description": "Comment",
},
"extends": {
"prefix": "extends",
"body": "{% extends ${1:\"${2:template}\"} %}",
"description": "Extends",
},
"filter": {
"prefix": "filter",
"body": "{% filter ${1:filter} %}\n\t$2\n{% endfilter %}",
"description": "Filter",
},
"for": {
"prefix": "for",
"body": "{% for ${1:item} in ${2:sequence} %}\n\t$3\n{% endfor %}",
"description": "For",
},
"if": {
"prefix": "if",
"body": "{% if ${1:expr} %}\n\t$2\n{% endif %}",
"description": "If",
},
"elif": {
"prefix": "elif",
"body": "{% elif ${1:expr} %}\n\t",
"description": "Elif",
},
"macro": {
"prefix": "macro",
"body": "{% macro ${1:name}(${2:args}) %}\n\t$3\n{% endmacro %}",
"description": "Macro",
},
"raw": {
"prefix": "raw",
"body": "{% raw %}\n${TM_SELECTED_TEXT:${1:text}}\n{% endraw %}",
"description": "Raw,"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment