Add some twig-mode snippets
This commit is contained in:
parent
00019a1e90
commit
3f90dcdd7d
6 changed files with 36 additions and 0 deletions
5
emacs/.emacs.d/snippets/twig-mode/_self
Normal file
5
emacs/.emacs.d/snippets/twig-mode/_self
Normal 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))`} %}
|
7
emacs/.emacs.d/snippets/twig-mode/def
Normal file
7
emacs/.emacs.d/snippets/twig-mode/def
Normal 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 %}
|
7
emacs/.emacs.d/snippets/twig-mode/for
Normal file
7
emacs/.emacs.d/snippets/twig-mode/for
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# -*- mode: snippet; require-final-newline: nil -*-
|
||||||
|
# name: for
|
||||||
|
# key: for
|
||||||
|
# --
|
||||||
|
{% for $1 in $2 %}
|
||||||
|
`yas-selected-text`$0
|
||||||
|
{% endfor %}
|
5
emacs/.emacs.d/snippets/twig-mode/iif
Normal file
5
emacs/.emacs.d/snippets/twig-mode/iif
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- mode: snippet; require-final-newline: nil -*-
|
||||||
|
# name: Inline if
|
||||||
|
# key: iif
|
||||||
|
# --
|
||||||
|
{% if $1 %}$0{% endif %}
|
7
emacs/.emacs.d/snippets/twig-mode/imp
Normal file
7
emacs/.emacs.d/snippets/twig-mode/imp
Normal 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)} %}
|
5
emacs/.emacs.d/snippets/twig-mode/set
Normal file
5
emacs/.emacs.d/snippets/twig-mode/set
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- mode: snippet; require-final-newline: nil -*-
|
||||||
|
# name: set
|
||||||
|
# key: set
|
||||||
|
# --
|
||||||
|
{% set $1 = $2 %}
|
Loading…
Reference in a new issue