Add some twig-mode snippets

This commit is contained in:
Tom Willemse 2015-12-16 22:26:55 +01:00
parent 00019a1e90
commit 3f90dcdd7d
6 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: _self
# key: _self
# --
{% import _self as ${1:`(file-name-nondirectory (file-name-sans-extension buffer-file-name))`} %}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: default value
# key: def
# --
{% if $1 is not defined %}
{% set $1 = $2 %}
{% endif %}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: for
# key: for
# --
{% for $1 in $2 %}
`yas-selected-text`$0
{% endfor %}

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: Inline if
# key: iif
# --
{% if $1 %}$0{% endif %}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: import
# key: imp
# --
{% import "${1:module}" as ${1:$(if (string-match "/\\\\([^/]*\\\\)$" yas-text)
(match-string 1 yas-text)
yas-text)} %}

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: set
# key: set
# --
{% set $1 = $2 %}