diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets index 01ab715..ff3e6f3 100644 --- a/UltiSnips/php.snippets +++ b/UltiSnips/php.snippets @@ -11,6 +11,12 @@ snippet def "def" define('${1:VARIABLE_NAME}', ${2:'definition'});${3} endsnippet +snippet wh "while" +while (${1}) { + ${0:${VISUAL}} +} +endsnippet + snippet do "do" do { ${2:// code... } @@ -39,9 +45,9 @@ interface ${1:someClass} } // END interface $1" endsnippet -snippet else "else" +snippet el "else" else { - ${1:// code...} + ${0:${VISUAL}} } endsnippet @@ -62,14 +68,14 @@ $_GET['${1}']${2} endsnippet snippet if "if" -if (${1:/* condition */}) { - ${2:// code...} +if (${1}) { + ${0:${VISUAL}} } endsnippet -snippet elif "elseif" -elseif (${1:/* condition */}) { - ${2:// code...} +snippet eif "elseif" +elseif (${1}) { + ${0:${VISUAL}} } endsnippet diff --git a/UltiSnips/twig.snippets b/UltiSnips/twig.snippets index 156b981..c470d9b 100644 --- a/UltiSnips/twig.snippets +++ b/UltiSnips/twig.snippets @@ -20,10 +20,28 @@ endsnippet snippet if "twig if" b {% if ${1} %} -${2} +${0:${VISUAL}} {% endif %} endsnippet +snippet ife "twig if ... else" b +{% if ${1} %} +${2} +{% else %} +${0} +{% endif %} +endsnippet + +snippet el "twig else" +{% else %} +${0:${VISUAL}} +endsnippet + +snippet eif "twig elseif" +{% elseif ${1} %} +${0:${VISUAL}} +endsnippet + snippet for "twig for" b {% for ${1} in ${2} %} ${3} diff --git a/snippets/php.snippets b/snippets/php.snippets index 269e55b..f611c7c 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -299,7 +299,7 @@ snippet el ${0} } snippet eif - elseif (${1:/* condition */}) { + elseif (${1}) { ${0} } snippet switch diff --git a/snippets/twig.snippets b/snippets/twig.snippets new file mode 100644 index 0000000..dcd1a04 --- /dev/null +++ b/snippets/twig.snippets @@ -0,0 +1,43 @@ +# twig block +snippet bl +{% block ${1} %} +${2} +{% endblock $1 %} +# twig javascripts +snippet js +{% javascripts '${1}' %} + +{% endjavascripts %} +# twig stylesheets +snippet css +{% stylesheets '${1}' %} + +{% endstylesheets %} +# twig if +snippet if +{% if ${1} %} +${2} +{% endif %} +# twig if ... else +snippet ife +{% if ${1} %} +${2} +{% else %} +${0} +{% endif %} +# twig else +snippet el +{% else %} +${0} +# twig elseif +snippet eif +{% elseif ${1} %} +${0} +# twig for +snippet for +{% for ${1} in ${2} %} +${3} +{% endfor %} +# twig extends +snippet ext +{% extends ${1} %}