summaryrefslogtreecommitdiff
path: root/luasnip_snippets/jinja2.json
diff options
context:
space:
mode:
Diffstat (limited to 'luasnip_snippets/jinja2.json')
-rw-r--r--luasnip_snippets/jinja2.json186
1 files changed, 186 insertions, 0 deletions
diff --git a/luasnip_snippets/jinja2.json b/luasnip_snippets/jinja2.json
new file mode 100644
index 0000000..622b06b
--- /dev/null
+++ b/luasnip_snippets/jinja2.json
@@ -0,0 +1,186 @@
+{
+ "block": {
+ "prefix": "block",
+ "description": "block",
+ "body": [
+ "{% block ${1:name} %\\}",
+ "\t\t$2",
+ "{% endblock $1 %\\}"
+ ],
+ "luasnip": {
+ "priority": -50
+ }
+ },
+ "{{": {
+ "prefix": "{{",
+ "description": "variable",
+ "body": "{{ $1 \\}\\}"
+ },
+ "{#": {
+ "prefix": "{#",
+ "description": "comment",
+ "body": "{# $1 #\\}"
+ },
+ "#": {
+ "prefix": "#",
+ "description": "comment",
+ "body": "{# $1 #\\}"
+ },
+ "raw": {
+ "prefix": "raw",
+ "description": "escaped block",
+ "body": [
+ "{% raw %\\}",
+ "\t\t$1",
+ "{% endraw %\\}"
+ ]
+ },
+ "extends": {
+ "prefix": "extends",
+ "description": "extends",
+ "body": "{% extends \"${1:template}\" %\\}"
+ },
+ "include": {
+ "prefix": "include",
+ "description": "include",
+ "body": "{% include \"${1:template}\" %\\}"
+ },
+ "import": {
+ "prefix": "import",
+ "description": "import",
+ "body": "{% import \"${1:template}\" %\\}"
+ },
+ "from": {
+ "prefix": "from",
+ "description": "from/import/as",
+ "body": "{% from \"${1:template}\" import ${2:name}${3: as ${4:$2}} %\\}"
+ },
+ "filter": {
+ "prefix": "filter",
+ "description": "filter",
+ "body": [
+ "{% filter ${1:filter} %\\}",
+ "\t$2",
+ "{% endfilter %\\}"
+ ]
+ },
+ "for": {
+ "prefix": "for",
+ "description": "for/else",
+ "body": [
+ "{% for ${1:item} in ${2:sequence} %\\}",
+ "\t$3",
+ "{% else %\\}",
+ "\t$4",
+ "{% endfor %\\}"
+ ]
+ },
+ "if": {
+ "prefix": "if",
+ "description": "if/elif/else",
+ "body": [
+ "{% if ${1:expr} %\\}",
+ "\t$2",
+ "{% elif %\\}",
+ "\t$3",
+ "{% else %\\}",
+ "\t$4",
+ "{% endif %\\}"
+ ]
+ },
+ "macro": {
+ "prefix": "macro",
+ "description": "macro",
+ "body": [
+ "{% macro ${1:name}(${2:args}) %\\}",
+ "\t$3",
+ "{% endmacro %\\}"
+ ]
+ },
+ "call": {
+ "prefix": "call",
+ "description": "call",
+ "body": [
+ "{% call ${1:name}(${2:args}) %\\}",
+ "\t$3",
+ "{% endcall %\\}"
+ ]
+ },
+ "set": {
+ "prefix": "set",
+ "description": "set",
+ "body": "{% set ${1:name} = ${2:'value'} %\\}"
+ },
+ "trans": {
+ "prefix": "trans",
+ "description": "translation",
+ "body": [
+ "{% trans %\\}",
+ "\t$1",
+ "{% endtrans %\\}"
+ ]
+ },
+ "with": {
+ "prefix": "with",
+ "description": "with",
+ "body": [
+ "{% with %\\}",
+ "\t$1",
+ "{% endwith %\\}"
+ ]
+ },
+ "autoescape": {
+ "prefix": "autoescape",
+ "description": "autoescape",
+ "body": [
+ "{% autoescape ${1:true} %\\}",
+ "\t$2",
+ "{% endautoescape %\\}"
+ ]
+ },
+ "batch": {
+ "prefix": "batch",
+ "description": "batch items",
+ "body": "batch(linecount=$1, fill_with=${2:None})"
+ },
+ "dictsort": {
+ "prefix": "dictsort",
+ "description": "sort and yield (key, value) pairs",
+ "body": "dictsort(case_sensitive=${1:False}, by=${2:'key'})"
+ },
+ "round": {
+ "prefix": "round",
+ "description": "round number",
+ "body": "round(precision=${1:0}, method=${2:'common|ceil|floor'})"
+ },
+ "urlize": {
+ "prefix": "urlize",
+ "description": "convert plain-text url to <a/>",
+ "body": "urlize(trim_url_limit=${1:None}, nofollow=${2:False})"
+ },
+ "wordwrap": {
+ "prefix": "wordwrap",
+ "description": "wordwrap",
+ "body": "wordwrap(width=${1:79}, break_long_words=${2:True})"
+ },
+ "truncate": {
+ "prefix": "truncate",
+ "description": "truncate",
+ "body": "truncate(lenght=${1:79}, killwords=${2:False}, end=${3:'...''})"
+ },
+ "sum": {
+ "prefix": "sum",
+ "description": "sum of sequence of numbers + start",
+ "body": "sum(attribute=${1:None}, start=${2:0})"
+ },
+ "sort": {
+ "prefix": "sort",
+ "description": "sort an iterable",
+ "body": "sort(reverse=${1:False}, case_sensitive=${2:False}, attribute=${3:None})"
+ },
+ "indent": {
+ "prefix": "indent",
+ "description": "indent",
+ "body": "indent(width=${1:4}, indentfirst=${2:False})"
+ }
+}