From b34243e79bce3eda0d7c1afdc3b1135cbb598307 Mon Sep 17 00:00:00 2001 From: amarakon Date: Thu, 1 Sep 2022 16:27:37 -0400 Subject: [PATCH 01/51] Improve Markdown and R Markdown snippets --- snippets/markdown.snippets | 24 +++++++++++---- snippets/rmd.snippets | 60 ++------------------------------------ 2 files changed, 20 insertions(+), 64 deletions(-) diff --git a/snippets/markdown.snippets b/snippets/markdown.snippets index 364066cfa..39ccecd76 100644 --- a/snippets/markdown.snippets +++ b/snippets/markdown.snippets @@ -67,17 +67,21 @@ snippet <* <`@*`> snippet -snippet ** - **${1:bold}** -snippet __ - __${1:bold}__ -snippet === +snippet ** Bold + **$0** +snippet __ Bold + __$0__ +snippet --- Front matter + --- + $0 + --- +snippet ==== `repeat('=', strlen(getline(line('.') - 3)))` ${0} snippet - - ${0} -snippet --- +snippet ---- `repeat('-', strlen(getline(line('.') - 3)))` ${0} @@ -142,3 +146,11 @@ snippet pullquote {% pullquote %} ${1:text} {" ${2:quote} "} ${0:text} {% endpullquote %} + +# Definition lists +snippet : Definition list + $1 + : $0 +snippet :: Alternate definition list + $1 + - $0 diff --git a/snippets/rmd.snippets b/snippets/rmd.snippets index 96b0ea0e4..bfaaefd76 100644 --- a/snippets/rmd.snippets +++ b/snippets/rmd.snippets @@ -6,6 +6,8 @@ # vim's `"*` register---i.e., the contents of the # system clipboard---to insert text. +extends markdown + # Insert Title Block snippet %% % ${1:`Filename('', 'title')`} @@ -20,64 +22,6 @@ snippet %%* ${4} -# Insert Definition List -snippet :: - ${1:term} - ~ ${2:definition} - -# Underline with `=`s or `-`s -snippet === - `repeat('=', strlen(getline(line(".") - 1)))` - - ${1} -snippet --- - `repeat('-', strlen(getline(line(".") - 1)))` - - ${1} - -# Links and their kin -# ------------------- -# -# (These don't play very well with delimitMate) -# - -snippet [ - [${1:link}](http://${2:url} "${3:title}")${4} -snippet [* - [${1:link}](${2:`@*`} "${3:title}")${4} - -snippet [: - [${1:id}]: http://${2:url} "${3:title}" -snippet [:* - [${1:id}]: ${2:`@*`} "${3:title}" - -snippet [@ - [${1:link}](mailto:${2:email})${3} -snippet [@* - [${1:link}](mailto:${2:`@*`})${3} - -snippet [:@ - [${1:id}]: mailto:${2:email} "${3:title}" -snippet [:@* - [${1:id}]: mailto:${2:`@*`} "${3:title}" - -snippet ![ - ![${1:alt}](${2:url} "${3:title}")${4} -snippet ![* - ![${1:alt}](${2:`@*`} "${3:title}")${4} - -snippet ![: - ![${1:id}]: ${2:url} "${3:title}" -snippet ![:* - ![${1:id}]: ${2:`@*`} "${3:title}" - -snippet [^: - [^${1:id}]: ${2:note} -snippet [^:* - [^${1:id}]: ${2:`@*`} - -# - # library() snippet req require(${1:}, quietly = TRUE) From 0ad1efb34ea81c34131faea8fdf1d68ecededa11 Mon Sep 17 00:00:00 2001 From: Amar Al-Zubaidi <92645199+amarakon@users.noreply.github.com> Date: Thu, 1 Sep 2022 16:32:47 -0400 Subject: [PATCH 02/51] `pandoc`: delete an extra line --- snippets/pandoc.snippets | 1 - 1 file changed, 1 deletion(-) diff --git a/snippets/pandoc.snippets b/snippets/pandoc.snippets index 1dd9e82eb..c94e53432 100644 --- a/snippets/pandoc.snippets +++ b/snippets/pandoc.snippets @@ -1,2 +1 @@ extends markdown - From 0d65141fb7512618651b307c561dda135db7c323 Mon Sep 17 00:00:00 2001 From: amarakon Date: Mon, 5 Sep 2022 13:14:55 -0400 Subject: [PATCH 03/51] `sh`: `#!/usr/bin/env sh` -> `#!/bin/sh` `#!/bin/sh` is actually more portable than `#!/usr/bin/env sh`. --- snippets/sh.snippets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/snippets/sh.snippets b/snippets/sh.snippets index 9c7573327..75d51b9d2 100644 --- a/snippets/sh.snippets +++ b/snippets/sh.snippets @@ -1,9 +1,9 @@ -# Shebang. Executing bash via /usr/bin/env makes scripts more portable. +# Shebang snippet #! - #!/usr/bin/env sh + #!/bin/sh snippet s#! - #!/usr/bin/env sh + #!/bin/sh set -eu snippet safe From 2058ac6d2da18ee06cad6513f9c5c2d211f03493 Mon Sep 17 00:00:00 2001 From: amarakon Date: Mon, 5 Sep 2022 19:07:21 -0400 Subject: [PATCH 04/51] Remove unnecessary placeholder text --- snippets/actionscript.snippets | 7 +++---- snippets/arduino.snippets | 10 +++++----- snippets/autoit.snippets | 12 ++++++------ snippets/bash.snippets | 8 ++++---- snippets/c.snippets | 8 ++++---- snippets/codeigniter.snippets | 2 +- snippets/coffee/coffee.snippets | 16 +++++++-------- snippets/crystal.snippets | 12 ++++++------ snippets/dart.snippets | 6 +++--- snippets/elixir.snippets | 12 ++++++------ snippets/falcon.snippets | 6 +++--- snippets/fortran.snippets | 4 ++-- snippets/go.snippets | 4 ++-- snippets/haml.snippets | 4 ++-- snippets/htmltornado.snippets | 6 +++--- snippets/java.snippets | 4 ++-- snippets/javascript/javascript.snippets | 6 +++--- snippets/liquid.snippets | 24 +++++++++++------------ snippets/lpc.snippets | 8 ++++---- snippets/ls.snippets | 10 +++++----- snippets/lua.snippets | 10 +++++----- snippets/mako.snippets | 4 ++-- snippets/perl.snippets | 10 +++++----- snippets/perl6.snippets | 8 ++++---- snippets/php.snippets | 4 ++-- snippets/processing.snippets | 2 +- snippets/ps1.snippets | 12 ++++++------ snippets/python.snippets | 8 ++++---- snippets/r.snippets | 4 ++-- snippets/rmd.snippets | 4 ++-- snippets/ruby.snippets | 26 ++++++++++++------------- snippets/rust.snippets | 2 +- snippets/sass.snippets | 6 +++--- snippets/scss.snippets | 6 +++--- snippets/sh.snippets | 8 ++++---- snippets/yii.snippets | 22 ++++++++++----------- snippets/zsh.snippets | 10 +++++----- 37 files changed, 157 insertions(+), 158 deletions(-) diff --git a/snippets/actionscript.snippets b/snippets/actionscript.snippets index 5d7443902..e4b8c93bf 100644 --- a/snippets/actionscript.snippets +++ b/snippets/actionscript.snippets @@ -114,7 +114,7 @@ snippet forr } # If Condition snippet if - if (${1:/* condition */}) { + if ($1) { ${0:${VISUAL}} } snippet el @@ -122,8 +122,8 @@ snippet el ${0:${VISUAL}} } # Ternary conditional -snippet t - ${1:/* condition */} ? ${2:a} : ${0:b} +snippet t Ternary: `condition ? true : false` + $1 ? $2 : $0 snippet fun function ${1:function_name}(${2})${3} { @@ -150,4 +150,3 @@ snippet FlxSprite } } } - diff --git a/snippets/arduino.snippets b/snippets/arduino.snippets index a2732a5e9..7a59a30de 100644 --- a/snippets/arduino.snippets +++ b/snippets/arduino.snippets @@ -19,7 +19,7 @@ snippet def # if snippet if - if (${1:/* condition */}) { + if ($1) { ${0:${VISUAL}} } # else @@ -29,12 +29,12 @@ snippet el } # else if snippet elif - else if (${1:/* condition */}) { + else if ($1) { ${2} } # ifi snippet ifi - if (${1:/* condition */}) ${2}; + if ($1) ${2}; # switch snippet switch @@ -63,14 +63,14 @@ snippet forr } # while snippet wh - while (${1:/* condition */}) { + while ($1) { ${2} } # do... while snippet do do { ${2} - } while (${1:/* condition */}); + } while ($1); ## ## Functions # function definition diff --git a/snippets/autoit.snippets b/snippets/autoit.snippets index f973fbc37..48713e577 100644 --- a/snippets/autoit.snippets +++ b/snippets/autoit.snippets @@ -1,16 +1,16 @@ snippet if - If ${1:condition} Then + If $1 Then ${0:; True code} EndIf snippet el Else ${0} snippet eif - ElseIf ${1:condition} Then + ElseIf $1 Then ${0:; True code} # If/Else block snippet ife - If ${1:condition} Then + If $1 Then ${2:; True code} Else ${0:; Else code} @@ -26,7 +26,7 @@ snippet ifelif EndIf # Switch block snippet switch - Switch (${1:condition}) + Switch ($1) Case ${2:case1}: ${3:; Case 1 code} Case Else: @@ -34,7 +34,7 @@ snippet switch EndSwitch # Select block snippet select - Select (${1:condition}) + Select ($1) Case ${2:case1}: ${3:; Case 1 code} Case Else: @@ -42,7 +42,7 @@ snippet select EndSelect # While loop snippet wh - While (${1:condition}) + While ($1) ${0:; code...} WEnd # For loop diff --git a/snippets/bash.snippets b/snippets/bash.snippets index 973483c48..65b07072a 100644 --- a/snippets/bash.snippets +++ b/snippets/bash.snippets @@ -9,17 +9,17 @@ snippet s#! set -eu snippet if - if [[ ${1:condition} ]]; then + if [[ $1 ]]; then ${0:${VISUAL}} fi snippet elif - elif [[ ${1:condition} ]]; then + elif [[ $1 ]]; then ${0:${VISUAL}} snippet wh - while [[ ${1:condition} ]]; do + while [[ $1 ]]; do ${0:${VISUAL}} done snippet until - until [[ ${1:condition} ]]; do + until [[ $1 ]]; do ${0:${VISUAL}} done diff --git a/snippets/c.snippets b/snippets/c.snippets index f4db58a3c..df5595b9e 100644 --- a/snippets/c.snippets +++ b/snippets/c.snippets @@ -86,8 +86,8 @@ snippet elif snippet ifi if (${1:true}) ${0}; # ternary -snippet t - ${1:/* condition */} ? ${2:a} : ${3:b} +snippet t Ternary: `condition ? true : false` + $1 ? $2 : $0 # switch snippet switch switch (${1:/* variable */}) { @@ -138,7 +138,7 @@ snippet wht snippet do do { ${0:${VISUAL}} - } while (${1:/* condition */}); + } while ($1); ## ## Functions # function definition @@ -351,7 +351,7 @@ snippet getopt ## Assertions snippet asr - assert(${1:condition}); + assert($1); snippet anl assert(${1:ptr} != NULL); diff --git a/snippets/codeigniter.snippets b/snippets/codeigniter.snippets index c38aa4dbd..afaf9638c 100644 --- a/snippets/codeigniter.snippets +++ b/snippets/codeigniter.snippets @@ -99,7 +99,7 @@ snippet ci_db-select snippet ci_db-from $this->db->from("${1:table}");${2} snippet ci_db-join - $this->db->join("${1:table}", "${2:condition}", "${3:type}");${4} + $this->db->join("${1:table}", "$2", "${3:type}");${4} snippet ci_db-where $this->db->where("${1:key}", "${2:value}");${3} snippet ci_db-or_where diff --git a/snippets/coffee/coffee.snippets b/snippets/coffee/coffee.snippets index f23156cc8..76a822f25 100644 --- a/snippets/coffee/coffee.snippets +++ b/snippets/coffee/coffee.snippets @@ -54,24 +54,24 @@ snippet cla class .. extends .. constructor: .. ${0} # If snippet if - if ${1:condition} + if $1 ${0:${VISUAL}} # If __ Else snippet ife - if ${1:condition} + if $1 ${2:${VISUAL}} else - ${0:# body...} + ${0} # Else if snippet eif - else if ${1:condition} + else if $1 ${0:${VISUAL}} # Ternary If -snippet ifte - if ${1:condition} then ${2:value} else ${0:other} +snippet ifte Ternary + if $1 then $2 else $0 # Unless -snippet unl - ${1:action} unless ${0:condition} +snippet unl Unless + $1 unless $0 # Switch snippet swi switch ${1:object} diff --git a/snippets/crystal.snippets b/snippets/crystal.snippets index 34d254065..a5848f88e 100644 --- a/snippets/crystal.snippets +++ b/snippets/crystal.snippets @@ -1,12 +1,12 @@ snippet req require require "${1}" snippet case - case ${1:object} - when ${2:condition} + case $1 + when $2 ${0} end snippet when - when ${1:condition} + when $1 ${0} snippet def def ${1:method_name} @@ -17,17 +17,17 @@ snippet pdef ${0} end snippet if - if ${1:condition} + if $1 ${0:${VISUAL}} end snippet ife - if ${1:condition} + if $1 ${2:${VISUAL}} else ${0} end snippet wh - while ${1:condition} + while $1 ${0:${VISUAL}} end snippet cla class .. end diff --git a/snippets/dart.snippets b/snippets/dart.snippets index de5cb6239..f4fd4f13e 100644 --- a/snippets/dart.snippets +++ b/snippets/dart.snippets @@ -61,15 +61,15 @@ snippet fore ${0} } snippet wh - while (${1:/* condition */}) { + while ($1) { ${0} } snippet dowh do { ${0} - } while (${0:/* condition */}); + } while ($0); snippet as - assert(${0:/* condition */}); + assert($0); snippet try try { ${0:${VISUAL}} diff --git a/snippets/elixir.snippets b/snippets/elixir.snippets index ee093eb9c..c04c9ade6 100644 --- a/snippets/elixir.snippets +++ b/snippets/elixir.snippets @@ -13,29 +13,29 @@ snippet if if .. do .. end ${0:${VISUAL}} end snippet if: if .. do: .. - if ${1:condition}, do: ${0} + if $1, do: ${0} snippet ife if .. do .. else .. end - if ${1:condition} do + if $1 do ${2:${VISUAL}} else ${0} end snippet ife: if .. do: .. else: - if ${1:condition}, do: ${2}, else: ${0} + if $1, do: ${2}, else: ${0} snippet unless unless .. do .. end unless ${1} do ${0:${VISUAL}} end snippet unless: unless .. do: .. - unless ${1:condition}, do: ${0} + unless $1, do: ${0} snippet unlesse unless .. do .. else .. end - unless ${1:condition} do + unless $1 do ${2:${VISUAL}} else ${0} end snippet unlesse: unless .. do: .. else: - unless ${1:condition}, do: ${2}, else: ${0} + unless $1, do: ${2}, else: ${0} snippet cond cond do ${1} -> diff --git a/snippets/falcon.snippets b/snippets/falcon.snippets index c523980d6..5894fe1c3 100644 --- a/snippets/falcon.snippets +++ b/snippets/falcon.snippets @@ -19,13 +19,13 @@ snippet class # If snippet if - if ${1:condition} + if $1 ${0} end # If else snippet ife - if ${1:condition} + if $1 ${0} else ${1} @@ -33,7 +33,7 @@ snippet ife # If else if snippet eif - elif ${1:condition} + elif $1 ${0} # Switch case diff --git a/snippets/fortran.snippets b/snippets/fortran.snippets index 8cb6f9a75..a073424e4 100644 --- a/snippets/fortran.snippets +++ b/snippets/fortran.snippets @@ -64,7 +64,7 @@ snippet intent snippet / (/ $1 /) ${2:,&} ${0} snippet if - if (${1:condition}) then + if ($1) then ${0} end if snippet case @@ -78,7 +78,7 @@ snippet do ${0} end do snippet dow - do while (${1:condition}) + do while ($1) $2 end do snippet sub diff --git a/snippets/go.snippets b/snippets/go.snippets index 722e82fd4..7245252c6 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -64,13 +64,13 @@ snippet inf "full interface " } snippet if "if condition" - if ${1:/* condition */} { + if $1 { ${2:${VISUAL}} } snippet ife "if else condition" - if ${1:/* condition */} { + if $1 { ${2:${VISUAL}} } else { ${0} diff --git a/snippets/haml.snippets b/snippets/haml.snippets index b1feaa51f..798c555ee 100644 --- a/snippets/haml.snippets +++ b/snippets/haml.snippets @@ -26,12 +26,12 @@ snippet mt snippet mts = mail_to ${1:email_address}, ${2:name}, :subject => ${3}, :body => ${4} snippet ife - - if ${1:condition} + - if $1 ${2:${VISUAL}} - else ${0} snippet ifp - - if ${1:condition}.presence? + - if $1.presence? ${0:${VISUAL}} snippet ntc = number_to_currency(${1}) diff --git a/snippets/htmltornado.snippets b/snippets/htmltornado.snippets index 1620e11da..5dd81555e 100644 --- a/snippets/htmltornado.snippets +++ b/snippets/htmltornado.snippets @@ -24,11 +24,11 @@ snippet for snippet from {% from ${1:x} import ${0:y} %} snippet if - {% if ${1:condition} %} + {% if $1 %} ${0} {% end %} snippet eif - {% elif ${0:condition} %} + {% elif $0 %} snippet el {% else %} snippet import @@ -50,6 +50,6 @@ snippet try ${0} {% end %} snippet wh - {% while ${1:condition} %} + {% while $1 %} ${0} {% end %} diff --git a/snippets/java.snippets b/snippets/java.snippets index 997089774..d3e69684e 100644 --- a/snippets/java.snippets +++ b/snippets/java.snippets @@ -142,9 +142,9 @@ snippet ae snippet aae assertArrayEquals("${1:Failure message}", ${2:expecteds}, ${3:actuals}); snippet af - assertFalse("${1:Failure message}", ${2:condition}); + assertFalse("${1:Failure message}", $2); snippet at - assertTrue("${1:Failure message}", ${2:condition}); + assertTrue("${1:Failure message}", $2); snippet an assertNull("${1:Failure message}", ${2:object}); snippet ann diff --git a/snippets/javascript/javascript.snippets b/snippets/javascript/javascript.snippets index b34495c4b..de1ca113b 100644 --- a/snippets/javascript/javascript.snippets +++ b/snippets/javascript/javascript.snippets @@ -62,8 +62,8 @@ snippet ife "if (condition) { ... } else { ... }" ${2} } # tertiary conditional -snippet ter - ${1:/* condition */} ? ${2:/* if true */} : ${0:/* if false */} +snippet ter Ternary: `condition ? true : false` + $1 ? $2: $0 # switch snippet switch switch (${1:expression}) { @@ -117,7 +117,7 @@ snippet wht "(true) { ... }" snippet do "do { ... } while (condition)" do { ${0:${VISUAL}} - } while (${1:/* condition */}); + } while ($1); # For in loop snippet fori for (let ${1:prop} in ${2:object}) { diff --git a/snippets/liquid.snippets b/snippets/liquid.snippets index 72a78d0e4..e12bf0604 100644 --- a/snippets/liquid.snippets +++ b/snippets/liquid.snippets @@ -2,32 +2,32 @@ # https://marketplace.visualstudio.com/items?itemName=killalau.vscode-liquid-snippets snippet if - {% if ${1:condition} %} + {% if $1 %} ${0:${VISUAL}} {% endif %} snippet else {% else %} snippet elsif - {% elsif ${1:condition} %} + {% elsif $1 %} snippet ifelse - {% if ${1:condition} %} + {% if $1 %} ${2} {% else %} ${0} {% endif %} snippet unless - {% unless ${1:condition} %} + {% unless $1 %} ${0:${VISUAL}} {% endunless %} snippet case {% case ${1:variable} %} - {% when ${2:condition} %} + {% when $2 %} ${3} {% else %} ${0} {% endcase %} snippet when - {% when ${1:condition} %} + {% when $1 %} ${0:${VISUAL}} snippet cycle {% cycle '${1:odd}', '${2:even}' %} @@ -102,32 +102,32 @@ snippet javascript snippet comment- {%- comment -%}${0:${VISUAL}}{%- endcomment -%} snippet if- - {%- if ${1:condition} -%} + {%- if $1 -%} ${0:${VISUAL}} {%- endif -%} snippet else- {%- else -%} snippet elsif- - {%- elsif ${1:condition} -%} + {%- elsif $1 -%} snippet ifelse- - {%- if ${1:condition} -%} + {%- if $1 -%} ${2} {%- else -%} ${0} {%- endif -%} snippet unless- - {%- unless ${1:condition} -%} + {%- unless $1 -%} ${0:${VISUAL}} {%- endunless -%} snippet case- {%- case ${1:variable} -%} - {%- when ${2:condition} -%} + {%- when $2 -%} ${3} {%- else -%} ${0} {%- endcase -%} snippet when- - {%- when ${1:condition} -%} + {%- when $1 -%} ${0:${VISUAL}} snippet cycle- {%- cycle '${1:odd}', '${2:even}' -%} diff --git a/snippets/lpc.snippets b/snippets/lpc.snippets index 2a849efaf..3410c93b3 100644 --- a/snippets/lpc.snippets +++ b/snippets/lpc.snippets @@ -66,8 +66,8 @@ snippet elif snippet ifi if(${1:true}) ${0}; # ternary -snippet t - ${1:/* condition */} ? ${2:a} : ${3:b} +snippet t Ternary: `condition ? true : false` + $1 ? $2 : $0 # switch snippet switch switch(${1:/* variable */}) @@ -115,7 +115,7 @@ snippet forr } # while snippet wh - while(${1:/* condition */}) + while($1) { ${0:${VISUAL}} } @@ -123,7 +123,7 @@ snippet wh snippet do do{ ${0:${VISUAL}} - }while (${1:/* condition */}); + }while ($1); ## ## Functions # function definition diff --git a/snippets/ls.snippets b/snippets/ls.snippets index 7c924e64d..822119d99 100644 --- a/snippets/ls.snippets +++ b/snippets/ls.snippets @@ -54,24 +54,24 @@ snippet cla class .. extends .. constructor: .. ${5} # If snippet if - if ${1:condition} + if $1 ${2} # If __ Else snippet ife - if ${1:condition} + if $1 ${2} else ${3} # Else if snippet elif - else if ${1:condition} + else if $1 ${2} # Ternary If snippet ifte - if ${1:condition} then ${2:value} else ${3:other} + if $1 then $2 else $0 # Unless snippet unl - ${1:action} unless ${2:condition} + $1 unless $0 # Switch snippet swi switch ${1:object} diff --git a/snippets/lua.snippets b/snippets/lua.snippets index 868f2f62a..855ec6f14 100644 --- a/snippets/lua.snippets +++ b/snippets/lua.snippets @@ -20,24 +20,24 @@ snippet fori ${0:-- body} end snippet if - if ${1:condition} then + if $1 then ${2:-- body} end snippet ife - if ${1:condition} then + if $1 then ${2:-- if condition} else ${0:-- else} end snippet elif - elseif ${1:condition} then + elseif $1 then ${0:--body} snippet repeat repeat ${1:--body} - until ${0:condition} + until $0 snippet while - while ${1:condition} do + while $1 do ${0:--body} end snippet wh diff --git a/snippets/mako.snippets b/snippets/mako.snippets index 659caf77d..b2ff4052a 100644 --- a/snippets/mako.snippets +++ b/snippets/mako.snippets @@ -19,11 +19,11 @@ snippet for ${0:} % endfor snippet if if - % if ${1:condition}: + % if $1: ${0:} % endif snippet ife if/else - % if ${1:condition}: + % if $1: ${2:} % else: ${0:} diff --git a/snippets/perl.snippets b/snippets/perl.snippets index b318d18c5..79ddad433 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -40,7 +40,7 @@ snippet eif } # Conditional One-line snippet xif - ${1:expression} if ${2:condition}; + $1 if $0; # Unless conditional snippet unless unless (${1}) { @@ -48,7 +48,7 @@ snippet unless } # Unless conditional One-line snippet xunless - ${1:expression} unless ${2:condition}; + $1 unless $0; # Try/Except snippet eval local $@; @@ -65,7 +65,7 @@ snippet wh } # While Loop One-line snippet xwh - ${1:expression} while ${2:condition}; + $1 while $0; # C-style For Loop snippet cfor for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) { @@ -73,7 +73,7 @@ snippet cfor } # For loop one-line snippet xfor - ${1:expression} for @${2:array}; + $1 for @$0; # Foreach Loop snippet for foreach my $${1:x} (@${2:array}) { @@ -81,7 +81,7 @@ snippet for } # Foreach Loop One-line snippet fore - ${1:expression} foreach @${2:array}; + $1 foreach @$0; # Package snippet package package ${1:`expand('%:p:s?.*lib/??:r:gs?/?::?')`}; diff --git a/snippets/perl6.snippets b/snippets/perl6.snippets index aa7406059..e7db89a1e 100644 --- a/snippets/perl6.snippets +++ b/snippets/perl6.snippets @@ -33,7 +33,7 @@ snippet eif } # Conditional One-line snippet xif - ${1:expression} if ${2:condition}; + ${1} if $2; # Unless conditional snippet unless unless ${1} { @@ -41,14 +41,14 @@ snippet unless } # Unless conditional One-line snippet xunless - ${1:expression} unless ${2:condition}; + ${1} unless $2; # Ternary conditional snippet tc - ${1:condition} ?? ${2:value-if-true} !! ${3:value-if-false}; + $1 ?? ${2:value-if-true} !! ${3:value-if-false}; # given - when (perl6 switch) snippet switch given ${1:$var} { - when ${2:condition} { + when $2 { ${3:# code block ...} } ${4} diff --git a/snippets/php.snippets b/snippets/php.snippets index c769baabb..b0bae1b3c 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -86,7 +86,7 @@ snippet =?: snippet ?: ${1:true} ? ${2:a} : ${0} snippet t "$retVal = (condition) ? a : b" - $${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b}; + $${1:retVal} = ($2) ? ${3:a} : ${4:b}; # Predefined variables snippet C $_COOKIE['${1:variable}'] @@ -283,7 +283,7 @@ snippet def "define('VARIABLE_NAME', 'definition')" snippet def? ${1}defined('${2}') snippet wh "while (condition) { ... }" - while (${1:/* condition */}) { + while ($1) { ${0:${VISUAL}} } snippet do "do { ... } while (condition)" diff --git a/snippets/processing.snippets b/snippets/processing.snippets index 798e54583..0fe69022b 100644 --- a/snippets/processing.snippets +++ b/snippets/processing.snippets @@ -64,7 +64,7 @@ snippet for }; #loop while snippet wh - while (${1:/* condition */}) { + while ($1) { ${0} } #break diff --git a/snippets/ps1.snippets b/snippets/ps1.snippets index 08de1efd8..652f0d861 100644 --- a/snippets/ps1.snippets +++ b/snippets/ps1.snippets @@ -43,13 +43,13 @@ snippet enum # PowerShell if..then snippet if - if (${1:condition}) { - ${2:statement} + if ($1) { + $0 } # PowerShell if..else snippet ife - if ( ${1:condition} ) { + if ( $1 ) { ${2} } else { @@ -58,8 +58,8 @@ snippet ife # PowerShell While Loop snippet while - while (${1:condition}) { - ${2:statement} + while ($1) { + $0 } # PowerShell Filter..Sort @@ -69,7 +69,7 @@ snippet filtersort # PowerShell foreach snippet foreach foreach ( $${1:iterator} in $${2:collection} ) { - ${3:statement} + $0 } # PowerShell export-csv diff --git a/snippets/python.snippets b/snippets/python.snippets index b980b54c0..75302a492 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -28,14 +28,14 @@ snippet sk "skip unittests" b @unittest.skip(${1:skip_reason}) snippet wh - while ${1:condition}: + while $1: ${0:${VISUAL}} # dowh - does the same as do...while in other languages snippet dowh while True: ${1} - if ${0:condition}: + if $0: break snippet with @@ -115,13 +115,13 @@ snippet property # Ifs snippet if - if ${1:condition}: + if $1: ${0:${VISUAL}} snippet el else: ${0:${VISUAL}} snippet ei - elif ${1:condition}: + elif $1: ${0:${VISUAL}} # Match diff --git a/snippets/r.snippets b/snippets/r.snippets index c3953bfc5..46f316c91 100644 --- a/snippets/r.snippets +++ b/snippets/r.snippets @@ -11,7 +11,7 @@ snippet source # conditionals snippet if - if (${1:condition}) { + if ($1) { ${0} } snippet el @@ -19,7 +19,7 @@ snippet el ${0} } snippet ei - else if (${1:condition}) { + else if ($1) { ${0} } diff --git a/snippets/rmd.snippets b/snippets/rmd.snippets index bfaaefd76..13d55363e 100644 --- a/snippets/rmd.snippets +++ b/snippets/rmd.snippets @@ -27,7 +27,7 @@ snippet req require(${1:}, quietly = TRUE) # If Condition snippet if - if ( ${1:condition} ) + if ( $1 ) { ${2:} } @@ -51,7 +51,7 @@ snippet fun snippet re repeat{ ${2:} - if(${1:condition}) break + if($1) break } # matrix diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 20c789b5b..34d56fb29 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -34,11 +34,11 @@ snippet # # => snippet case case ${1:object} - when ${2:condition} + when $2 ${0} end snippet when - when ${1:condition} + when $1 ${0:${VISUAL}} snippet def def ${1:method_name} @@ -55,46 +55,46 @@ snippet descendants end end snippet if - if ${1:condition} + if $1 ${0:${VISUAL}} end snippet ife - if ${1:condition} + if $1 ${2:${VISUAL}} else ${0} end snippet eif - elsif ${1:condition} + elsif $1 ${0:${VISUAL}} snippet ifee - if ${1:condition} + if $1 $2 - elsif ${3:condition} + elsif $3 $4 else $0 end snippet unless - unless ${1:condition} + unless $1 ${0:${VISUAL}} end snippet unlesse - unless ${1:condition} + unless $1 $2 else $0 end snippet unlesee - unless ${1:condition} + unless $1 $2 - elsif ${3:condition} + elsif $3 $4 else $0 end snippet wh - while ${1:condition} + while $1 ${0:${VISUAL}} end snippet for @@ -102,7 +102,7 @@ snippet for ${0} end snippet until - until ${1:condition} + until $1 ${0:${VISUAL}} end snippet cla class .. end diff --git a/snippets/rust.snippets b/snippets/rust.snippets index 5e9eb2b18..04f05dd60 100644 --- a/snippets/rust.snippets +++ b/snippets/rust.snippets @@ -147,7 +147,7 @@ snippet loop "loop {}" b ${0:${VISUAL}} } snippet wh "while loop" - while ${1:condition} { + while $1 { ${0:${VISUAL}} } snippet whl "while let (...)" diff --git a/snippets/sass.snippets b/snippets/sass.snippets index 30bac6c7e..992341e7c 100644 --- a/snippets/sass.snippets +++ b/snippets/sass.snippets @@ -13,15 +13,15 @@ snippet fun @function ${1:name}(${2:args}) ${0} snippet if - @if ${1:condition} + @if $1 ${0:${VISUAL}} snippet ife - @if ${1:condition} + @if $1 ${2:${VISUAL}} @else ${0} snippet eif - @else if ${1:condition} + @else if $1 ${0:${VISUAL}} snippet for @for ${1:$i} from ${2:1} through ${3:3} diff --git a/snippets/scss.snippets b/snippets/scss.snippets index 998a12005..475c2b387 100644 --- a/snippets/scss.snippets +++ b/snippets/scss.snippets @@ -17,17 +17,17 @@ snippet fun ${0} } snippet if - @if ${1:condition} { + @if $1 { ${0} } snippet ife - @if ${1:condition} { + @if $1 { ${2} } @else { ${0} } snippet eif - @else if ${1:condition} { + @else if $1 { ${0} } snippet for diff --git a/snippets/sh.snippets b/snippets/sh.snippets index 75d51b9d2..37f985f18 100644 --- a/snippets/sh.snippets +++ b/snippets/sh.snippets @@ -18,11 +18,11 @@ snippet sbash IFS=$'\n\t' snippet if - if [ ${1:condition} ]; then + if [ $1 ]; then ${0:${VISUAL}} fi snippet elif - elif [ ${1:condition} ]; then + elif [ $1 ]; then ${0:${VISUAL}} snippet for for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do @@ -33,7 +33,7 @@ snippet fori ${0:${VISUAL}} done snippet wh - while [ ${1:condition} ]; do + while [ $1 ]; do ${0:${VISUAL}} done snippet wht @@ -41,7 +41,7 @@ snippet wht ${0:${VISUAL}} done snippet until - until [ ${1:condition} ]; do + until [ $1 ]; do ${0:${VISUAL}} done snippet case diff --git a/snippets/yii.snippets b/snippets/yii.snippets index 1f9fc6f78..1aecad293 100644 --- a/snippets/yii.snippets +++ b/snippets/yii.snippets @@ -144,7 +144,7 @@ snippet yrp #----------------Yii Model----------------------------- #Yii Model count snippet ycountm - ${1:ModelName}::model()->count(${2:condition}, array('${3:key}'=>${0:value})); + ${1:ModelName}::model()->count($2, array('${3:key}'=>${0:value})); #Yii Model countBySql snippet ycountbs @@ -152,35 +152,35 @@ snippet ycountbs #Yii Model updateAll snippet yupdatea - ${1:ModelName}::model()->updateAll(${2:array('attributes')}, ${3:condition},array('${4:key}'=>${0:value})); + ${1:ModelName}::model()->updateAll(${2:array('attributes')}, $3,array('${4:key}'=>${0:value})); #Yii Model updateByPk snippet yupdatebp - ${1:ModelName}::model()->updateByPk(${2:pk}, ${3:array('attributes')}, ${4:condition},array('${5:key}'=>${0:value})); + ${1:ModelName}::model()->updateByPk(${2:pk}, ${3:array('attributes')}, $4,array('${5:key}'=>${0:value})); #Yii Model deleteAll snippet ydela - ${1:ModelName}::model()->deleteAll(${2:condition},array('${3:key}'=>${0:value})); + ${1:ModelName}::model()->deleteAll($2,array('${3:key}'=>${0:value})); #Yii Model deleteByPk snippet ydelbp - ${1:ModelName}::model()->deleteByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${0:value})); + ${1:ModelName}::model()->deleteByPk(${2:pk}, $3, array('${4:key}'=>${0:value})); #Yii Model find snippet yfind - ${1:ModelName}::model()->find(${2:condition},array('${3:key}'=>${0:value})); + ${1:ModelName}::model()->find($2,array('${3:key}'=>${0:value})); #Yii Model findAll snippet yfinda - ${1:ModelName}::model()->findAll(${2:condition},array('${3:key}'=>${0:value})); + ${1:ModelName}::model()->findAll($2,array('${3:key}'=>${0:value})); #Yii Model findByPk snippet yfindbp - ${1:ModelName}::model()->findByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${0:value})); + ${1:ModelName}::model()->findByPk(${2:pk}, $3, array('${4:key}'=>${0:value})); #Yii Model findAllByPk snippet yfindabp - ${1:ModelName}::model()->findAllByPk(${2:pk}, ${3:condition},array('${4:key}'=>${0:value})); + ${1:ModelName}::model()->findAllByPk(${2:pk}, $3,array('${4:key}'=>${0:value})); #Yii Model findBySql snippet yfindbs @@ -188,11 +188,11 @@ snippet yfindbs #Yii Model findAllByAttributes snippet yfindaba - ${1:ModelName}::model()->findAllByAttributes(array('${2:attributeName}'=>${3:attributeValue}), ${4:condition}, array('${5:key}'=>${0:value})); + ${1:ModelName}::model()->findAllByAttributes(array('${2:attributeName}'=>${3:attributeValue}), $4, array('${5:key}'=>${0:value})); #Yii Model exists snippet yexists - ${1:ModelName}::model()->exists(${2:condition}, array('${3:key}'=>${0:value})); + ${1:ModelName}::model()->exists($2, array('${3:key}'=>${0:value})); #Yii Create model class snippet ymodel diff --git a/snippets/zsh.snippets b/snippets/zsh.snippets index 63061fe8e..485766fea 100644 --- a/snippets/zsh.snippets +++ b/snippets/zsh.snippets @@ -5,17 +5,17 @@ snippet #! #!/usr/bin/env zsh snippet if - if ${1:condition}; then + if $1; then ${0:${VISUAL}} fi snippet ife - if ${1:condition}; then + if $1; then ${2:${VISUAL}} else ${0:# statements} fi snippet eif - elif ${1:condition}; then + elif $1; then ${0:${VISUAL}} snippet for for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do @@ -30,11 +30,11 @@ snippet fore ${0:${VISUAL}} done snippet wh - while ${1:condition}; do + while $1; do ${0:${VISUAL}} done snippet until - until ${1:condition}; do + until $1; do ${0:${VISUAL}} done snippet repeat From b055962fcc0f9d868521785fd423cca493de353a Mon Sep 17 00:00:00 2001 From: amarakon Date: Wed, 7 Sep 2022 16:24:09 -0400 Subject: [PATCH 05/51] Remove unnecessary body placeholder text --- snippets/clojure.snippets | 4 ++-- snippets/coffee/coffee.snippets | 20 ++++++++++---------- snippets/erlang.snippets | 12 ++++++------ snippets/html.snippets | 2 +- snippets/lua.snippets | 14 +++++++------- snippets/plsql.snippets | 6 +++--- snippets/rst.snippets | 2 +- snippets/sh.snippets | 4 ++-- 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/snippets/clojure.snippets b/snippets/clojure.snippets index 048ce9fee..cc9d07043 100644 --- a/snippets/clojure.snippets +++ b/snippets/clojure.snippets @@ -81,7 +81,7 @@ snippet print snippet reduce (reduce ${1:(fn [p n] ${3})} ${2}) snippet when - (when ${1:test} ${0:body}) + (when ${1:test} $0) snippet when-let (when-let [${1:result} ${2:test}] - ${0:body}) + $0) diff --git a/snippets/coffee/coffee.snippets b/snippets/coffee/coffee.snippets index 76a822f25..d07b1b624 100644 --- a/snippets/coffee/coffee.snippets +++ b/snippets/coffee/coffee.snippets @@ -2,37 +2,37 @@ snippet forindo for ${1:name} in ${2:array} do ($1) -> - ${0:// body} + $0 # Array comprehension snippet fora for ${1:name} in ${2:array} - ${0:# body...} + $0 # Object comprehension snippet foro for ${1:key}, ${2:value} of ${3:object} - ${0:# body...} + $0 # Range comprehension (inclusive) snippet forr for ${1:name} in [${2:start}..${3:finish}] - ${0:# body...} + $0 snippet forrb for ${1:name} in [${2:start}..${3:finish}] by ${4:step} - ${0:# body...} + $0 # Range comprehension (exclusive) snippet forrex for ${1:name} in [${2:start}...${3:finish}] - ${0:# body...} + $0 snippet forrexb for ${1:name} in [${2:start}...${3:finish}] by ${4:step} - ${0:# body...} + $0 # Function snippet fun (${1:args}) -> - ${0:# body...} + $0 # Function (bound) snippet bfun (${1:args}) => - ${0:# body...} + $0 # Class snippet cla class .. class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} @@ -76,7 +76,7 @@ snippet unl Unless snippet swi switch ${1:object} when ${2:value} - ${0:# body...} + $0 # Log snippet log diff --git a/snippets/erlang.snippets b/snippets/erlang.snippets index 7a0a6116a..d655a9b9a 100644 --- a/snippets/erlang.snippets +++ b/snippets/erlang.snippets @@ -17,7 +17,7 @@ snippet dt erlang:display({${1}, ${0}}), # define directive snippet def - -define(${1:macro}, ${2:body}). + -define(${1:macro}, $2). # export directive snippet exp -export([${1:function}/${0:arity}]). @@ -44,17 +44,17 @@ snippet undef snippet if if ${1:guard} -> - ${0:body} + $0 end # case expression snippet case case ${1:expression} of ${2:pattern} -> - ${0:body}; + $0; end # anonymous function snippet fun - fun (${1:Parameters}) -> ${2:body} end + fun (${1:Parameters}) -> $2 end # try...catch snippet try try @@ -65,10 +65,10 @@ snippet try snippet rcv "Receive Expression" receive ${1: ${2:pattern}${3: when ${4:guard}} -> - ${5:body}} + $5 ${6:after ${7:expression} -> - ${8:body}} + $8 end # record directive snippet rec diff --git a/snippets/html.snippets b/snippets/html.snippets index bf7170032..5388dbc8e 100644 --- a/snippets/html.snippets +++ b/snippets/html.snippets @@ -456,7 +456,7 @@ snippet html5l ${3:link} - ${0:body} + $0 snippet i diff --git a/snippets/lua.snippets b/snippets/lua.snippets index 855ec6f14..87cdc8e4a 100644 --- a/snippets/lua.snippets +++ b/snippets/lua.snippets @@ -5,7 +5,7 @@ snippet local local ${1:x} = ${0:1} snippet fun function ${1:fname}(${2:...}) - ${0:-- body} + $0 end snippet for for ${1:i}=${2:1},${3:10} do @@ -13,15 +13,15 @@ snippet for end snippet forp for ${1:i},${2:v} in pairs(${3:table_name}) do - ${0:-- body} + $0 end snippet fori for ${1:i},${2:v} in ipairs(${3:table_name}) do - ${0:-- body} + $0 end snippet if if $1 then - ${2:-- body} + $2 end snippet ife if $1 then @@ -31,14 +31,14 @@ snippet ife end snippet elif elseif $1 then - ${0:--body} + $0 snippet repeat repeat - ${1:--body} + $1 until $0 snippet while while $1 do - ${0:--body} + $0 end snippet wh while ${1:true} do diff --git a/snippets/plsql.snippets b/snippets/plsql.snippets index 2920758ad..6a75f7739 100644 --- a/snippets/plsql.snippets +++ b/snippets/plsql.snippets @@ -8,7 +8,7 @@ snippet ps snippet pb create or replace package body ${1:name} as - ${0:-- body} + $0 end; -- end of package body $1; # package procedure spec snippet pps @@ -18,7 +18,7 @@ snippet ppb procedure ${1:name}(${2:args}) as begin - ${0:-- body} + $0 end $2; # package function spec snippet pfs @@ -31,7 +31,7 @@ snippet pfb as l_res $3; begin - ${0:-- body}; + $0; return l_res; end $1; # snow errors diff --git a/snippets/rst.snippets b/snippets/rst.snippets index 31b4fec20..8279af5a0 100644 --- a/snippets/rst.snippets +++ b/snippets/rst.snippets @@ -1,7 +1,7 @@ # rst snippet : - :${1:field name}: ${0:field body} + :${1:field name}: $0 snippet * *${1:Emphasis}* ${0} snippet ** diff --git a/snippets/sh.snippets b/snippets/sh.snippets index 37f985f18..ef94e683e 100644 --- a/snippets/sh.snippets +++ b/snippets/sh.snippets @@ -101,10 +101,10 @@ snippet root snippet fun-sh ${1:function_name}() { - ${0:#function_body} + $0 } snippet fun function ${1:function_name}() { - ${0:#function_body} + $0 } From 724c1ecb64e87580dd5b85378849eb89c593abcc Mon Sep 17 00:00:00 2001 From: Shad Date: Sun, 4 Sep 2022 14:37:40 +0200 Subject: [PATCH 06/51] add snippets for smarty --- snippets/smarty.snippets | 144 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 snippets/smarty.snippets diff --git a/snippets/smarty.snippets b/snippets/smarty.snippets new file mode 100644 index 000000000..59899900d --- /dev/null +++ b/snippets/smarty.snippets @@ -0,0 +1,144 @@ +# snippets for smarty3 + +extends html +extends javascript +extends css + +# https://www.smarty.net/docs/en/language.function.if.tpl +snippet if "{if cond} ... {/if}" + {if ${1}} + ${0:${VISUAL}} + {/if} + +snippet ifn "{if !cond} ... {/if}" + {if ${1}} + ${0:${VISUAL}} + {/if} + +snippet ife "{if cond} ... {else} ... {/if}" + {if ${1}} + ${0:${VISUAL}} + {else} + ${2} + {/if} + +snippet eif "{elseif cond} ... {/if}" + {elseif ${1}} + ${0:${VISUAL}} + {/if} + +snippet el "{else} ... {/if}" + {else} + ${1} + {/if} + +# https://www.smarty.net/docs/en/language.function.for.tpl +snippet for "The {for} tag is used to create simple loops." + {for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max ${7}}} + ${0:${VISUAL}} + {/for} + +snippet forelse "The {for}{forelse} tag is used to create simple loops." + {for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max ${7}}} + ${0:${VISUAL}} + {forelse} + ${7} + {/for} + +# https://www.smarty.net/docs/en/language.function.foreach.tpl +snippet foreach "{foreach} is used for looping over arrays of data." + {foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}} + ${0:${VISUAL}} + {/foreach} + +snippet foreach2 "[Smarty2] {foreach} is used for looping over arrays of data." + {foreach from='$${1:collection} item='${2}'${3: key='${4}'}${5: name='${6}'}} + ${0:${VISUAL}} + {/foreach} + +snippet foreachelse "{foreach} is used for looping over arrays of data." + {foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}} + ${0:${VISUAL}} + {foreachelse} + ${5} + {/foreach} + +snippet wh "{while} loops in Smarty have much the same flexibility as PHP while statements, with a few added features for the template engine. Every {while} must be paired with a matching {/while}. All PHP conditionals and functions are recognized, such as ||, or, &&, and, is_array(), etc." + {while ${1} } + ${0:${VISUAL}} + {/while} + + + +# https://www.smarty.net/docs/en/language.function.append.tpl +snippet append "{append} is used for creating or appending template variable arrays during the execution of a template." + {append var='${1}' value='${2}'${3: index='${4:first|last}'}${5: scope='${6:parent|root|global}'}} + +# https://www.smarty.net/docs/en/language.function.assign.tpl +snippet assign "{assign} is used for assigning template variables during the execution of a template." + {assign var='${1}' value='${2}'${3: scope='${4parent|root|global}'}} + +# https://www.smarty.net/docs/en/language.function.block.tpl +snippet block "{block} is used to define a named area of template source for template inheritance." + {block name='${1:name}'} + ${0:${VISUAL}} + {/block} + +# https://www.smarty.net/docs/en/language.function.call.tpl +snippet call "{call} is used to call a template function defined by the {function} tag just like a plugin function." + {call name=${1:name}${2: assign=${3}} ${0}} + +# https://www.smarty.net/docs/en/language.function.capture.tpl +snippet capture "{capture} is used to collect the output of the template between the tags into a variable instead of displaying it. Any content between {capture name='foo'} and {/capture} is collected into the variable specified in the name attribute. " + {capture name='${1}'${2: assign='${3:variable}' }${4: append='${5:array_variable}'}} + ${0:${VISUAL}} + {/capture} + +# https://www.smarty.net/docs/en/language.function.config.load.tpl +snippet config_load "config_load" + {config_load file='${1}'${2: section='${3}'}${4: scope='${5:local|parent|global}'}] + +# https://www.smarty.net/docs/en/language.function.extends.tpl +snippet extends "{extends} tags are used in child templates in template inheritance for extending parent templates." + {extends file='${1}'} + +# https://www.smarty.net/docs/en/language.function.function.tpl +snippet function "{function} is used to create functions within a template and call them just like a plugin function. Instead of writing a plugin that generates presentational content, keeping it in the template is often a more manageable choice. It also simplifies data traversal, such as deeply nested menus." + {function name='${1}' ${2:variables}} + ${0:${VISUAL}} + {/function} + +snippet include "{include} tags are used for including other templates in the current template. Any variables available in the current template are also available within the included template." + {include file='${1}'${2: assign='${3:name}'}${4: cache_lifetime=${5}}${6: compile_id='${7}'}${8: cache_id='${9}'}${10: scope='${11:parent|root|global}'}${12: variables}} + +# https://www.smarty.net/docs/en/language.function.literal.tpl +snippet literal "{literal} tags allow a block of data to be taken literally. This is typically used around Javascript or stylesheet blocks where {curly braces} would interfere with the template delimiter syntax" + {literal} + ${0:${VISUAL}} + {/literal} + +# https://www.smarty.net/docs/en/language.function.nocache.tpl +snippet nocache "{nocache} is used to disable caching of a template section. Every {nocache} must be paired with a matching {/nocache}." + {nocache} + ${0:${VISUAL}} + {/nocache} + +# https://www.smarty.net/docs/en/language.function.section.tpl +snippet section "A {section} is for looping over sequentially indexed arrays of data, unlike {foreach} which is used to loop over a single associative array. Every {section} tag must be paired with a closing {/section} tag." + {section name='${1}'${2: loop='${3}'}${4: start=${5}}${6: step=${7}}${8: max=${9}}${10: show=${11}}} + ${0:${VISUAL}} + {/section} + +# https://www.smarty.net/docs/en/language.function.setfilter.tpl +snippet setfilter "The {setfilter}...{/setfilter} block tag allows the definition of template instance's variable filters." + {setfilter ${1:filters}} + ${0:${VISUAL}} + {/setfilter} + +# https://www.smarty.net/docs/en/language.function.strip.tpl +snippet strip "Anything within {strip}{/strip} tags are stripped of the extra spaces or carriage returns at the beginnings and ends of the lines before they are displayed. This way you can keep your templates readable, and not worry about extra white space causing problems." + {strip} + ${0:${VISUAL}} + {/strip} + + From 835a7cf3ad7281dde7832ecaac26e6e56cda5be9 Mon Sep 17 00:00:00 2001 From: Shad Date: Sun, 4 Sep 2022 18:05:59 +0200 Subject: [PATCH 07/51] typo --- snippets/smarty.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/smarty.snippets b/snippets/smarty.snippets index 59899900d..39e060a3c 100644 --- a/snippets/smarty.snippets +++ b/snippets/smarty.snippets @@ -76,7 +76,7 @@ snippet append "{append} is used for creating or appending template variable arr # https://www.smarty.net/docs/en/language.function.assign.tpl snippet assign "{assign} is used for assigning template variables during the execution of a template." - {assign var='${1}' value='${2}'${3: scope='${4parent|root|global}'}} + {assign var='${1}' value='${2}'${3: scope='${4:parent|root|global}'}} # https://www.smarty.net/docs/en/language.function.block.tpl snippet block "{block} is used to define a named area of template source for template inheritance." From 83f437b210219a97d25adaf01e6c6e65b551568d Mon Sep 17 00:00:00 2001 From: Shad Date: Mon, 5 Sep 2022 09:28:10 +0200 Subject: [PATCH 08/51] convert to UltiSnips format + remove trivial placeholder --- {snippets => UltiSnips}/smarty.snippets | 167 ++++++++++++++---------- 1 file changed, 96 insertions(+), 71 deletions(-) rename {snippets => UltiSnips}/smarty.snippets (67%) diff --git a/snippets/smarty.snippets b/UltiSnips/smarty.snippets similarity index 67% rename from snippets/smarty.snippets rename to UltiSnips/smarty.snippets index 39e060a3c..77c5f4ce0 100644 --- a/snippets/smarty.snippets +++ b/UltiSnips/smarty.snippets @@ -6,139 +6,164 @@ extends css # https://www.smarty.net/docs/en/language.function.if.tpl snippet if "{if cond} ... {/if}" - {if ${1}} - ${0:${VISUAL}} - {/if} +{if ${1}} + ${0:${VISUAL}} +{/if} +endsnippet snippet ifn "{if !cond} ... {/if}" - {if ${1}} - ${0:${VISUAL}} - {/if} +{if ${1}} + ${0:${VISUAL}} +{/if} +endsnippet snippet ife "{if cond} ... {else} ... {/if}" - {if ${1}} - ${0:${VISUAL}} - {else} - ${2} - {/if} +{if ${1}} + ${0:${VISUAL}} +{else} + ${2} +{/if} +endsnippet snippet eif "{elseif cond} ... {/if}" - {elseif ${1}} - ${0:${VISUAL}} - {/if} +{elseif ${1}} + ${0:${VISUAL}} +{/if} +endsnippet snippet el "{else} ... {/if}" - {else} - ${1} - {/if} +{else} + ${1} +{/if} +endsnippet # https://www.smarty.net/docs/en/language.function.for.tpl snippet for "The {for} tag is used to create simple loops." - {for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max ${7}}} - ${0:${VISUAL}} - {/for} +{for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max=${7}}} + ${0:${VISUAL}} +{/for} +endsnippet snippet forelse "The {for}{forelse} tag is used to create simple loops." - {for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max ${7}}} - ${0:${VISUAL}} - {forelse} - ${7} - {/for} +{for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max=${7}}} + ${0:${VISUAL}} +{forelse} + ${8} +{/for} +endsnippet # https://www.smarty.net/docs/en/language.function.foreach.tpl snippet foreach "{foreach} is used for looping over arrays of data." - {foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}} - ${0:${VISUAL}} - {/foreach} +{foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}} + ${0:${VISUAL}} +{/foreach} +endsnippet snippet foreach2 "[Smarty2] {foreach} is used for looping over arrays of data." - {foreach from='$${1:collection} item='${2}'${3: key='${4}'}${5: name='${6}'}} - ${0:${VISUAL}} - {/foreach} +{foreach from='$${1:collection} item='${2}'${3: key='${4}'}${5: name='${6}'}} + ${0:${VISUAL}} +{/foreach} +endsnippet snippet foreachelse "{foreach} is used for looping over arrays of data." - {foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}} - ${0:${VISUAL}} - {foreachelse} - ${5} - {/foreach} +{foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}} + ${0:${VISUAL}} +{foreachelse} + ${5} +{/foreach} +endsnippet snippet wh "{while} loops in Smarty have much the same flexibility as PHP while statements, with a few added features for the template engine. Every {while} must be paired with a matching {/while}. All PHP conditionals and functions are recognized, such as ||, or, &&, and, is_array(), etc." - {while ${1} } - ${0:${VISUAL}} - {/while} +{while ${1} } + ${0:${VISUAL}} +{/while} +endsnippet + # https://www.smarty.net/docs/en/language.function.append.tpl snippet append "{append} is used for creating or appending template variable arrays during the execution of a template." - {append var='${1}' value='${2}'${3: index='${4:first|last}'}${5: scope='${6:parent|root|global}'}} +{append var='${1}' value='${2}'${3: index='${4|first,last|}'}${5: scope='${6|parent,root,global|}'}} +endsnippet # https://www.smarty.net/docs/en/language.function.assign.tpl snippet assign "{assign} is used for assigning template variables during the execution of a template." - {assign var='${1}' value='${2}'${3: scope='${4:parent|root|global}'}} +{assign var='${1}' value='${2}'${3: scope='${4|parent,root,global|}'}} +endsnippet # https://www.smarty.net/docs/en/language.function.block.tpl snippet block "{block} is used to define a named area of template source for template inheritance." - {block name='${1:name}'} - ${0:${VISUAL}} - {/block} +{block name='${1}'} + ${0:${VISUAL}} +{/block} +endsnippet # https://www.smarty.net/docs/en/language.function.call.tpl snippet call "{call} is used to call a template function defined by the {function} tag just like a plugin function." - {call name=${1:name}${2: assign=${3}} ${0}} +{call name=${1}${2: assign=${3}}${4: variables}} +endsnippet # https://www.smarty.net/docs/en/language.function.capture.tpl snippet capture "{capture} is used to collect the output of the template between the tags into a variable instead of displaying it. Any content between {capture name='foo'} and {/capture} is collected into the variable specified in the name attribute. " - {capture name='${1}'${2: assign='${3:variable}' }${4: append='${5:array_variable}'}} - ${0:${VISUAL}} - {/capture} +{capture name='${1}'${2: assign='${3}' }${4: append='${5:array_variable}'}} + ${0:${VISUAL}} +{/capture} +endsnippet # https://www.smarty.net/docs/en/language.function.config.load.tpl snippet config_load "config_load" - {config_load file='${1}'${2: section='${3}'}${4: scope='${5:local|parent|global}'}] +{config_load file='${1}'${2: section='${3}'}${4: scope='${5|local,parent,global|}'}] +endsnippet # https://www.smarty.net/docs/en/language.function.extends.tpl snippet extends "{extends} tags are used in child templates in template inheritance for extending parent templates." - {extends file='${1}'} +{extends file='${1}'} +endsnippet # https://www.smarty.net/docs/en/language.function.function.tpl snippet function "{function} is used to create functions within a template and call them just like a plugin function. Instead of writing a plugin that generates presentational content, keeping it in the template is often a more manageable choice. It also simplifies data traversal, such as deeply nested menus." - {function name='${1}' ${2:variables}} - ${0:${VISUAL}} - {/function} +{function name='${1}' ${2:variables}} + ${0:${VISUAL}} +{/function} +endsnippet +# https://www.smarty.net/docs/en/language.function.include.tpl snippet include "{include} tags are used for including other templates in the current template. Any variables available in the current template are also available within the included template." - {include file='${1}'${2: assign='${3:name}'}${4: cache_lifetime=${5}}${6: compile_id='${7}'}${8: cache_id='${9}'}${10: scope='${11:parent|root|global}'}${12: variables}} +{include file='${1}'${2: assign='${3}'}${4: cache_lifetime=${5}}${6: compile_id='${7}'}${8: cache_id='${9}'}${10: scope='${11|parent,root,global|}'}${12: variables}} +endsnippet # https://www.smarty.net/docs/en/language.function.literal.tpl snippet literal "{literal} tags allow a block of data to be taken literally. This is typically used around Javascript or stylesheet blocks where {curly braces} would interfere with the template delimiter syntax" - {literal} - ${0:${VISUAL}} - {/literal} +{literal} + ${0:${VISUAL}} +{/literal} +endsnippet # https://www.smarty.net/docs/en/language.function.nocache.tpl snippet nocache "{nocache} is used to disable caching of a template section. Every {nocache} must be paired with a matching {/nocache}." - {nocache} - ${0:${VISUAL}} - {/nocache} +{nocache} + ${0:${VISUAL}} +{/nocache} +endsnippet # https://www.smarty.net/docs/en/language.function.section.tpl snippet section "A {section} is for looping over sequentially indexed arrays of data, unlike {foreach} which is used to loop over a single associative array. Every {section} tag must be paired with a closing {/section} tag." - {section name='${1}'${2: loop='${3}'}${4: start=${5}}${6: step=${7}}${8: max=${9}}${10: show=${11}}} - ${0:${VISUAL}} - {/section} +{section name='${1}'${2: loop='${3}'}${4: start=${5}}${6: step=${7}}${8: max=${9}}${10: show=${11}}} + ${0:${VISUAL}} +{/section} +endsnippet # https://www.smarty.net/docs/en/language.function.setfilter.tpl snippet setfilter "The {setfilter}...{/setfilter} block tag allows the definition of template instance's variable filters." - {setfilter ${1:filters}} - ${0:${VISUAL}} - {/setfilter} +{setfilter ${1:filters}} + ${0:${VISUAL}} +{/setfilter} +endsnippet # https://www.smarty.net/docs/en/language.function.strip.tpl snippet strip "Anything within {strip}{/strip} tags are stripped of the extra spaces or carriage returns at the beginnings and ends of the lines before they are displayed. This way you can keep your templates readable, and not worry about extra white space causing problems." - {strip} - ${0:${VISUAL}} - {/strip} - - +{strip} + ${0:${VISUAL}} +{/strip} +endsnippet From 7a268565575acea413afa3e2649f17004e40285d Mon Sep 17 00:00:00 2001 From: Shad Date: Thu, 8 Sep 2022 22:04:09 +0200 Subject: [PATCH 09/51] split snippet in snipMate & UltiSnips format snipMate for the plain simple snippets UltiSnips for the four snippets with choices selection (append, assign, config_load, include) --- UltiSnips/smarty.snippets | 143 +------------------------------------- snippets/smarty.snippets | 139 ++++++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+), 142 deletions(-) create mode 100644 snippets/smarty.snippets diff --git a/UltiSnips/smarty.snippets b/UltiSnips/smarty.snippets index 77c5f4ce0..09677d6f3 100644 --- a/UltiSnips/smarty.snippets +++ b/UltiSnips/smarty.snippets @@ -4,81 +4,6 @@ extends html extends javascript extends css -# https://www.smarty.net/docs/en/language.function.if.tpl -snippet if "{if cond} ... {/if}" -{if ${1}} - ${0:${VISUAL}} -{/if} -endsnippet - -snippet ifn "{if !cond} ... {/if}" -{if ${1}} - ${0:${VISUAL}} -{/if} -endsnippet - -snippet ife "{if cond} ... {else} ... {/if}" -{if ${1}} - ${0:${VISUAL}} -{else} - ${2} -{/if} -endsnippet - -snippet eif "{elseif cond} ... {/if}" -{elseif ${1}} - ${0:${VISUAL}} -{/if} -endsnippet - -snippet el "{else} ... {/if}" -{else} - ${1} -{/if} -endsnippet - -# https://www.smarty.net/docs/en/language.function.for.tpl -snippet for "The {for} tag is used to create simple loops." -{for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max=${7}}} - ${0:${VISUAL}} -{/for} -endsnippet - -snippet forelse "The {for}{forelse} tag is used to create simple loops." -{for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max=${7}}} - ${0:${VISUAL}} -{forelse} - ${8} -{/for} -endsnippet - -# https://www.smarty.net/docs/en/language.function.foreach.tpl -snippet foreach "{foreach} is used for looping over arrays of data." -{foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}} - ${0:${VISUAL}} -{/foreach} -endsnippet - -snippet foreach2 "[Smarty2] {foreach} is used for looping over arrays of data." -{foreach from='$${1:collection} item='${2}'${3: key='${4}'}${5: name='${6}'}} - ${0:${VISUAL}} -{/foreach} -endsnippet - -snippet foreachelse "{foreach} is used for looping over arrays of data." -{foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}} - ${0:${VISUAL}} -{foreachelse} - ${5} -{/foreach} -endsnippet - -snippet wh "{while} loops in Smarty have much the same flexibility as PHP while statements, with a few added features for the template engine. Every {while} must be paired with a matching {/while}. All PHP conditionals and functions are recognized, such as ||, or, &&, and, is_array(), etc." -{while ${1} } - ${0:${VISUAL}} -{/while} -endsnippet - @@ -92,78 +17,12 @@ snippet assign "{assign} is used for assigning template variables during the exe {assign var='${1}' value='${2}'${3: scope='${4|parent,root,global|}'}} endsnippet -# https://www.smarty.net/docs/en/language.function.block.tpl -snippet block "{block} is used to define a named area of template source for template inheritance." -{block name='${1}'} - ${0:${VISUAL}} -{/block} -endsnippet - -# https://www.smarty.net/docs/en/language.function.call.tpl -snippet call "{call} is used to call a template function defined by the {function} tag just like a plugin function." -{call name=${1}${2: assign=${3}}${4: variables}} -endsnippet - -# https://www.smarty.net/docs/en/language.function.capture.tpl -snippet capture "{capture} is used to collect the output of the template between the tags into a variable instead of displaying it. Any content between {capture name='foo'} and {/capture} is collected into the variable specified in the name attribute. " -{capture name='${1}'${2: assign='${3}' }${4: append='${5:array_variable}'}} - ${0:${VISUAL}} -{/capture} -endsnippet - # https://www.smarty.net/docs/en/language.function.config.load.tpl snippet config_load "config_load" -{config_load file='${1}'${2: section='${3}'}${4: scope='${5|local,parent,global|}'}] -endsnippet - -# https://www.smarty.net/docs/en/language.function.extends.tpl -snippet extends "{extends} tags are used in child templates in template inheritance for extending parent templates." -{extends file='${1}'} -endsnippet - -# https://www.smarty.net/docs/en/language.function.function.tpl -snippet function "{function} is used to create functions within a template and call them just like a plugin function. Instead of writing a plugin that generates presentational content, keeping it in the template is often a more manageable choice. It also simplifies data traversal, such as deeply nested menus." -{function name='${1}' ${2:variables}} - ${0:${VISUAL}} -{/function} +{config_load file='${1}'${2: section='${3}'}${4: scope='${5|local,parent,global|}'}} endsnippet # https://www.smarty.net/docs/en/language.function.include.tpl snippet include "{include} tags are used for including other templates in the current template. Any variables available in the current template are also available within the included template." {include file='${1}'${2: assign='${3}'}${4: cache_lifetime=${5}}${6: compile_id='${7}'}${8: cache_id='${9}'}${10: scope='${11|parent,root,global|}'}${12: variables}} endsnippet - -# https://www.smarty.net/docs/en/language.function.literal.tpl -snippet literal "{literal} tags allow a block of data to be taken literally. This is typically used around Javascript or stylesheet blocks where {curly braces} would interfere with the template delimiter syntax" -{literal} - ${0:${VISUAL}} -{/literal} -endsnippet - -# https://www.smarty.net/docs/en/language.function.nocache.tpl -snippet nocache "{nocache} is used to disable caching of a template section. Every {nocache} must be paired with a matching {/nocache}." -{nocache} - ${0:${VISUAL}} -{/nocache} -endsnippet - -# https://www.smarty.net/docs/en/language.function.section.tpl -snippet section "A {section} is for looping over sequentially indexed arrays of data, unlike {foreach} which is used to loop over a single associative array. Every {section} tag must be paired with a closing {/section} tag." -{section name='${1}'${2: loop='${3}'}${4: start=${5}}${6: step=${7}}${8: max=${9}}${10: show=${11}}} - ${0:${VISUAL}} -{/section} -endsnippet - -# https://www.smarty.net/docs/en/language.function.setfilter.tpl -snippet setfilter "The {setfilter}...{/setfilter} block tag allows the definition of template instance's variable filters." -{setfilter ${1:filters}} - ${0:${VISUAL}} -{/setfilter} -endsnippet - -# https://www.smarty.net/docs/en/language.function.strip.tpl -snippet strip "Anything within {strip}{/strip} tags are stripped of the extra spaces or carriage returns at the beginnings and ends of the lines before they are displayed. This way you can keep your templates readable, and not worry about extra white space causing problems." -{strip} - ${0:${VISUAL}} -{/strip} -endsnippet diff --git a/snippets/smarty.snippets b/snippets/smarty.snippets new file mode 100644 index 000000000..070fcd7e1 --- /dev/null +++ b/snippets/smarty.snippets @@ -0,0 +1,139 @@ +# snippets for smarty3 + +extends html +extends javascript +extends css + +# https://www.smarty.net/docs/en/language.function.if.tpl +snippet if "{if cond} ... {/if}" + {if ${1}} + ${0:${VISUAL}} + {/if} + +snippet ifn "{if !cond} ... {/if}" + {if ${1}} + ${0:${VISUAL}} + {/if} + +snippet ife "{if cond} ... {else} ... {/if}" + {if ${1}} + ${0:${VISUAL}} + {else} + ${2} + {/if} + +snippet eif "{elseif cond} ... {/if}" + {elseif ${1}} + ${0:${VISUAL}} + {/if} + +snippet el "{else} ... {/if}" + {else} + ${1} + {/if} + +# https://www.smarty.net/docs/en/language.function.for.tpl +snippet for "The {for} tag is used to create simple loops." + {for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max=${7}}} + ${0:${VISUAL}} + {/for} + +snippet forelse "The {for}{forelse} tag is used to create simple loops." + {for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max=${7}}} + ${0:${VISUAL}} + {forelse} + ${8} + {/for} + +# https://www.smarty.net/docs/en/language.function.foreach.tpl +snippet foreach "{foreach} is used for looping over arrays of data." + {foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}} + ${0:${VISUAL}} + {/foreach} + +snippet foreach2 "[Smarty2] {foreach} is used for looping over arrays of data." + {foreach from=$${1:collection} item='${2}'${3: key='${4}'}${5: name='${6}'}} + ${0:${VISUAL}} + {/foreach} + +snippet foreachelse "{foreach} is used for looping over arrays of data." + {foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}} + ${0:${VISUAL}} + {foreachelse} + ${5} + {/foreach} + +snippet wh "{while} loops in Smarty have much the same flexibility as PHP while statements, with a few added features for the template engine. Every {while} must be paired with a matching {/while}. All PHP conditionals and functions are recognized, such as ||, or, &&, and, is_array(), etc." + {while ${1}} + ${0:${VISUAL}} + {/while} + + + +# https://www.smarty.net/docs/en/language.function.append.tpl +#snippet append implemented in UltiSnips format + +# https://www.smarty.net/docs/en/language.function.assign.tpl +#snippet assign implemented in UltiSnips format + +# https://www.smarty.net/docs/en/language.function.block.tpl +snippet block "{block} is used to define a named area of template source for template inheritance." + {block name='${1}'} + ${0:${VISUAL}} + {/block} + +# https://www.smarty.net/docs/en/language.function.call.tpl +snippet call "{call} is used to call a template function defined by the {function} tag just like a plugin function." + {call name=${1}${2: assign=${3}}${4: variables}} + +# https://www.smarty.net/docs/en/language.function.capture.tpl +snippet capture "{capture} is used to collect the output of the template between the tags into a variable instead of displaying it. Any content between {capture name='foo'} and {/capture} is collected into the variable specified in the name attribute. " + {capture name='${1}'${2: assign='${3}' }${4: append='${5:array_variable}'}} + ${0:${VISUAL}} + {/capture} + +# https://www.smarty.net/docs/en/language.function.config.load.tpl +#snippet config_load implemented in UltiSnips format + +# https://www.smarty.net/docs/en/language.function.extends.tpl +snippet extends "{extends} tags are used in child templates in template inheritance for extending parent templates." + {extends file='${1}'} + +# https://www.smarty.net/docs/en/language.function.function.tpl +snippet function "{function} is used to create functions within a template and call them just like a plugin function. Instead of writing a plugin that generates presentational content, keeping it in the template is often a more manageable choice. It also simplifies data traversal, such as deeply nested menus." + {function name='${1}' ${2:variables}} + ${0:${VISUAL}} + {/function} + +# https://www.smarty.net/docs/en/language.function.include.tpl +#snippet include implemented in UltiSnips format + +# https://www.smarty.net/docs/en/language.function.literal.tpl +snippet literal "{literal} tags allow a block of data to be taken literally. This is typically used around Javascript or stylesheet blocks where {curly braces} would interfere with the template delimiter syntax" + {literal} + ${0:${VISUAL}} + {/literal} + +# https://www.smarty.net/docs/en/language.function.nocache.tpl +snippet nocache "{nocache} is used to disable caching of a template section. Every {nocache} must be paired with a matching {/nocache}." + {nocache} + ${0:${VISUAL}} + {/nocache} + +# https://www.smarty.net/docs/en/language.function.section.tpl +snippet section "A {section} is for looping over sequentially indexed arrays of data, unlike {foreach} which is used to loop over a single associative array. Every {section} tag must be paired with a closing {/section} tag." + {section name='${1}'${2: loop='${3}'}${4: start=${5}}${6: step=${7}}${8: max=${9}}${10: show=${11}}} + ${0:${VISUAL}} + {/section} + +# https://www.smarty.net/docs/en/language.function.setfilter.tpl +snippet setfilter "The {setfilter}...{/setfilter} block tag allows the definition of template instance's variable filters." + {setfilter ${1:filters}} + ${0:${VISUAL}} + {/setfilter} + +# https://www.smarty.net/docs/en/language.function.strip.tpl +snippet strip "Anything within {strip}{/strip} tags are stripped of the extra spaces or carriage returns at the beginnings and ends of the lines before they are displayed. This way you can keep your templates readable, and not worry about extra white space causing problems." + {strip} + ${0:${VISUAL}} + {/strip} From cc77a816191e1ab649be67310adbb2471fd60e75 Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Sun, 11 Sep 2022 11:20:48 +0100 Subject: [PATCH 10/51] Snippet for #pragma once include guard It is non-standard, but most (all?) compilers implement it. See also https://en.wikipedia.org/wiki/Pragma_once#Portability --- UltiSnips/cpp.snippets | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UltiSnips/cpp.snippets b/UltiSnips/cpp.snippets index a997f001e..2202dfd69 100644 --- a/UltiSnips/cpp.snippets +++ b/UltiSnips/cpp.snippets @@ -30,6 +30,11 @@ endglobal ########################################################################### # TextMate Snippets # ########################################################################### +snippet ponce "#pragma once include guard" +#pragma once + +endsnippet + snippet main int main(int argc, char *argv[]) { From faaa499189c4ee3fe13860e675e2370d55e3e5dd Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Sun, 11 Sep 2022 20:32:45 +0100 Subject: [PATCH 11/51] C++ snippet for namespace and type aliases and for using directives and declarations --- UltiSnips/cpp.snippets | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/UltiSnips/cpp.snippets b/UltiSnips/cpp.snippets index 2202dfd69..4a22782fb 100644 --- a/UltiSnips/cpp.snippets +++ b/UltiSnips/cpp.snippets @@ -72,6 +72,14 @@ namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`} }${1/.+/ \/* /m}$1${1/.+/ *\/ /m} endsnippet +snippet nsa "namespace alias" +namespace ${1:alias} = ${2:namespace}; +endsnippet + +snippet using "using directive/using declaration/type alias" +using ${1:namespace}`!p snip.rv = ' ' if t[1] == 'namespace' else ' = ' if t[1] != '' else ''`${2:name}; +endsnippet + snippet readfile "read file (readF)" std::vector v; if (FILE *fp = fopen(${1:"filename"}, "r")) From 250fd916757a545e7dfa29a62afa1e7ea16e2460 Mon Sep 17 00:00:00 2001 From: Whyme Lyu Date: Fri, 7 Oct 2022 05:06:39 +0800 Subject: [PATCH 12/51] Escape $ in ruby.snippets for $PROGRAM_NAME --- snippets/ruby.snippets | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 34d56fb29..95de362e2 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -199,18 +199,18 @@ snippet defds snippet am alias_method :${1:new_name}, :${0:old_name} snippet app - if __FILE__ == $PROGRAM_NAME + if __FILE__ == \$PROGRAM_NAME ${0} end # usage_if() snippet usai if ARGV.${1} - abort "Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${0} + abort "Usage: #{\$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${0} end # usage_unless() snippet usau unless ARGV.${1} - abort "Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${0} + abort "Usage: #{\$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${0} end snippet array Array.new(${1:10}) { |${2:i}| ${0} } @@ -439,7 +439,7 @@ snippet optp options = { ${0:default: 'args'} } ARGV.options do |opts| - opts.banner = "Usage: #{File.basename($PROGRAM_NAME)}" + opts.banner = "Usage: #{File.basename(\$PROGRAM_NAME)}" end snippet opt opts.on('-${1:o}', '--${2:long-option-name}', ${3:String}, '${4:Option description.}') do |${5:opt}| From 9a7f3968c92c6589d3a12aa5448e8374c8d68a42 Mon Sep 17 00:00:00 2001 From: Craig Paterson Date: Mon, 10 Oct 2022 12:16:45 +1100 Subject: [PATCH 13/51] Add parentheses for IO call since the code formatter prefers it that way --- snippets/elixir.snippets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/snippets/elixir.snippets b/snippets/elixir.snippets index c04c9ade6..f0b17c4ed 100644 --- a/snippets/elixir.snippets +++ b/snippets/elixir.snippets @@ -3,9 +3,9 @@ snippet do ${0:${VISUAL}} end snippet put IO.puts - IO.puts "${0}" + IO.puts("${0}") snippet ins IO.inspect - IO.inspect ${0} + IO.inspect(${0}) snippet insl IO.inspect with label IO.inspect(${0}label: "${1:label}") snippet if if .. do .. end @@ -247,7 +247,7 @@ snippet >f pipe to filter snippet >r pipe to reduce |> Enum.reduce(${1:acc}, fn ${2}, ${3:acc} -> ${0} end) snippet >i pipe to inspect - |> IO.inspect + |> IO.inspect() snippet >il pipe to inspect with label |> IO.inspect(label: "${1:label}") snippet cs From 53851075981f6c785a0b96830f0689fc76078853 Mon Sep 17 00:00:00 2001 From: Craig Paterson Date: Mon, 10 Oct 2022 12:35:38 +1100 Subject: [PATCH 14/51] Improvements to the GenServer and Supervisor snippets --- snippets/elixir.snippets | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/snippets/elixir.snippets b/snippets/elixir.snippets index f0b17c4ed..d217489b6 100644 --- a/snippets/elixir.snippets +++ b/snippets/elixir.snippets @@ -265,22 +265,27 @@ snippet genserver basic genserver structure use GenServer @doc false - def start_link do - GenServer.start_link(__MODULE__, ${1:Map.new}) + def start_link(init_args) do + GenServer.start_link(__MODULE__, init_args, name: __MODULE__) end @impl true - def init(state) do - {:ok, state} + def init(_init_args) do + {:ok, []} end -snippet genserver: basic genserver structure - use GenServer +snippet super basic supervisor structure + use Supervisor @doc false - def start_link, do: GenServer.start_link(__MODULE__, ${1:Map.new}) + def start_link(init_args) do + Supervisor.start_link(__MODULE__, init_args, name: __MODULE__) + end @impl true - def init(state), do: {:ok, state} + def init(_init_args) do + children = [${1}] + Supervisor.init(children, strategy: :one_for_one) + end snippet impl @impl true def ${1:name} do From b47c2e37237875185d170f32cac67af5ab72f22d Mon Sep 17 00:00:00 2001 From: Craig Paterson Date: Tue, 11 Oct 2022 14:59:50 +1100 Subject: [PATCH 15/51] pass state into genserver --- snippets/elixir.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/elixir.snippets b/snippets/elixir.snippets index d217489b6..37b1c0191 100644 --- a/snippets/elixir.snippets +++ b/snippets/elixir.snippets @@ -270,8 +270,8 @@ snippet genserver basic genserver structure end @impl true - def init(_init_args) do - {:ok, []} + def init(state) do + {:ok, state} end snippet super basic supervisor structure use Supervisor From b904e5a68aeda29a0b6e09a6f61305a462ae2627 Mon Sep 17 00:00:00 2001 From: xuxin Date: Tue, 22 Nov 2022 15:19:23 +0800 Subject: [PATCH 16/51] fix lua "require" snippet --- snippets/lua.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/lua.snippets b/snippets/lua.snippets index 87cdc8e4a..6fe3fd365 100644 --- a/snippets/lua.snippets +++ b/snippets/lua.snippets @@ -68,5 +68,5 @@ snippet fwrs io.${1:stderr}:write("$0") snippet fwrf io.${1:stderr}:write(string.format("${2:%s}"$0)) -snippet im - import "${1:import file}" +snippet req + require('${1:mod}') From 6173350127d56dcc5664f50320b3f522951f56e9 Mon Sep 17 00:00:00 2001 From: Jimmy Z Date: Mon, 28 Nov 2022 02:46:12 +0000 Subject: [PATCH 17/51] Disabled auto trigger for leq and geq --- UltiSnips/tex.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UltiSnips/tex.snippets b/UltiSnips/tex.snippets index 00e910de4..8b71c283d 100644 --- a/UltiSnips/tex.snippets +++ b/UltiSnips/tex.snippets @@ -371,11 +371,11 @@ snippet != "Not Equal" w \neq endsnippet -snippet <= "leq" Aw +snippet <= "leq" w \le endsnippet -snippet >= "geq" Aw +snippet >= "geq" w \ge endsnippet From e96b116ab23d8cbb43f2c74296ea08c29955cc98 Mon Sep 17 00:00:00 2001 From: ybenel <44820142+M1ndo@users.noreply.github.com> Date: Wed, 7 Dec 2022 23:06:52 +0000 Subject: [PATCH 18/51] Adding Org Mode Adding Org-Mode snippets because they are missing. --- snippets/org.snippets | 125 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 snippets/org.snippets diff --git a/snippets/org.snippets b/snippets/org.snippets new file mode 100644 index 000000000..56ea5c8bd --- /dev/null +++ b/snippets/org.snippets @@ -0,0 +1,125 @@ +# Org Mode Snippets Imported from (https://github.com/doomemacs/snippets/) +# Imported by ybenel (github.com/m1ndo) + +# Begin +snippet begin + #+begin_${1:type} ${2:options} + $0 + #+end_$1 +# Begin Center +snippet Date: Wed, 7 Dec 2022 23:26:15 +0000 Subject: [PATCH 19/51] Updating Org Mode Fixing head snippet and adding sh and py snippets for export. --- snippets/org.snippets | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/snippets/org.snippets b/snippets/org.snippets index 56ea5c8bd..0559cd68a 100644 --- a/snippets/org.snippets +++ b/snippets/org.snippets @@ -36,6 +36,16 @@ snippet Date: Fri, 13 Jan 2023 14:26:40 +0100 Subject: [PATCH 20/51] Fixed constructors and createState definition --- snippets/dart-flutter.snippets | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/snippets/dart-flutter.snippets b/snippets/dart-flutter.snippets index f51f11ca4..86775cb6c 100644 --- a/snippets/dart-flutter.snippets +++ b/snippets/dart-flutter.snippets @@ -3,6 +3,8 @@ # Flutter stateless widget snippet stless class $1 extends StatelessWidget { + const $1({super.key}); + @override Widget build(BuildContext context) { return Container( @@ -14,8 +16,10 @@ snippet stless # Flutter stateful widget snippet stful class $1 extends StatefulWidget { + const $1({super.key}); + @override - _$1State createState() => _$1State(); + State<$1> createState() => _$1State(); } class _$1State extends State<$1> { @@ -30,8 +34,10 @@ snippet stful # Flutter widget with AnimationController snippet stanim class $1 extends StatefulWidget { + const $1({super.key}); + @override - _$1State createState() => _$1State(); + State<$1> createState() => _$1State(); } class _$1State extends State<$1> @@ -85,5 +91,3 @@ snippet fsa ); } } - - From 1049d2425b6d270621b48e110de37d5467a2a621 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Sat, 14 Jan 2023 15:45:35 +0000 Subject: [PATCH 21/51] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 8b31f770b..a54c31342 100644 --- a/README.md +++ b/README.md @@ -245,7 +245,6 @@ This list is kept up-to-date on a best effort basis. * Python - [honza](http://github.com/honza) * Ruby - [taq](http://github.com/taq) * Scala - [gorodinskiy](https://github.com/gorodinskiy) -* Supercollider - [lpil](https://github.com/lpil) License ------- From 5086416dad71ab4952cbf381a5103947f16ae134 Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Fri, 23 Dec 2022 14:02:48 +0000 Subject: [PATCH 22/51] LaTeX snippets for sectioning commands include labels --- UltiSnips/tex.snippets | 55 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/UltiSnips/tex.snippets b/UltiSnips/tex.snippets index 8b71c283d..f6b0cd8be 100644 --- a/UltiSnips/tex.snippets +++ b/UltiSnips/tex.snippets @@ -520,4 +520,59 @@ snippet subpar* "Sub Paragraph*" wi \subparagraph*{$1${VISUAL}} endsnippet +snippet chapl "Chapter with label" wi +\chapter{$1${VISUAL}} +\label{cha:${2:${1/\W+/-/g}}} +endsnippet + +snippet secl "Section with label" wi +\section{$1${VISUAL}} +\label{sec:${2:${1/\W+/-/g}}} +endsnippet + +snippet sec*l "Section* with label" wi +\section*{$1${VISUAL}} +\label{sec:${2:${1/\W+/-/g}}} +endsnippet + +snippet subl "Subsection with label" wi +\subsection{$1${VISUAL}} +\label{sub:${2:${1/\W+/-/g}}} +endsnippet + +snippet sub*l "Subsection* with label" wi +\subsection*{$1${VISUAL}} +\label{sub:${2:${1/\W+/-/g}}} +endsnippet + +snippet subsubl "Subsection with label" wi +\subsubsection{$1${VISUAL}} +\label{ssub:${2:${1/\W+/-/g}}} +endsnippet + +snippet subsub*l "Subsubsection with label" wi +\subsubsection*{$1${VISUAL}} +\label{ssub:${2:${1/\W+/-/g}}} +endsnippet + +snippet parl "Paragraph with label" wi +\paragraph{$1${VISUAL}} +\label{par:${2:${1/\W+/-/g}}} +endsnippet + +snippet par*l "Paragraph* with label" wi +\paragraph*{$1${VISUAL}} +\label{par:${2:${1/\W+/-/g}}} +endsnippet + +snippet subparl "Sub Paragraph with label" wi +\subparagraph{$1${VISUAL}} +\label{subp:${2:${1/\W+/-/g}}} +endsnippet + +snippet subpar*l "Sub Paragraph* with label" wi +\subparagraph*{$1${VISUAL}} +\label{subp:${2:${1/\W+/-/g}}} +endsnippet + # vim:ft=snippets: From 12a4415a60f2e8779d46aa8b35af34d908446cba Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Sat, 21 Jan 2023 14:09:01 +0000 Subject: [PATCH 23/51] Remove erroneous leading tabs from snippet --- UltiSnips/tex.snippets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/UltiSnips/tex.snippets b/UltiSnips/tex.snippets index f6b0cd8be..6feed6913 100644 --- a/UltiSnips/tex.snippets +++ b/UltiSnips/tex.snippets @@ -160,9 +160,9 @@ snippet abs "abstract environment" b endsnippet snippet tab "tabular / array environment" b - \begin{${1:t}${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${2:c}} - $0${2/(?<=.)(c|l|r)|./(?1: & )/g} - \end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}} +\begin{${1:t}${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${2:c}} +$0${2/(?<=.)(c|l|r)|./(?1: & )/g} +\end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}} endsnippet snippet table "Table environment" b From 6c35df156de83055860a2d75842b5defe996d742 Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Mon, 23 Jan 2023 20:05:18 +0000 Subject: [PATCH 24/51] Fix LaTeX snippet for inverse If you type 123>>invs, you'll see that it will be expanded to `3^{-1}`, throwing away anything but the last character before `invs`. This fixes it. --- UltiSnips/tex.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/tex.snippets b/UltiSnips/tex.snippets index 6feed6913..fa7a8e484 100644 --- a/UltiSnips/tex.snippets +++ b/UltiSnips/tex.snippets @@ -400,7 +400,7 @@ snippet Date: Mon, 23 Jan 2023 19:53:13 +0000 Subject: [PATCH 25/51] Remove invasive autotrigger for LaTeX snippet (fixes #1476) --- UltiSnips/tex.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/tex.snippets b/UltiSnips/tex.snippets index fa7a8e484..393b3eee9 100644 --- a/UltiSnips/tex.snippets +++ b/UltiSnips/tex.snippets @@ -384,7 +384,7 @@ snippet nn "Tikz node" w $0 endsnippet -snippet lll "l" Aw +snippet lll "l" w \ell endsnippet From 04a28bfe31fc4a6b105111a6f2da916bb2cdc359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sm=C3=A1ri?= Date: Tue, 24 Jan 2023 09:27:45 +0100 Subject: [PATCH 26/51] Replace the hash rocket syntax from ruby with a colon --- UltiSnips/eruby.snippets | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/UltiSnips/eruby.snippets b/UltiSnips/eruby.snippets index ef93be440..8d97277df 100644 --- a/UltiSnips/eruby.snippets +++ b/UltiSnips/eruby.snippets @@ -44,13 +44,13 @@ snippet fi "<%= Fixtures.identify(:symbol) %>" endsnippet snippet ft "form_tag" w -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_tag(${1::action => '${2:update}'}${3:, ${4:${5:class} => '${6:form}'\}}}) do`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_tag(${1:action: '${2:update}'}${3:, ${4:${5:class}: '${6:form}'\}}}) do`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` $0 `!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)` endsnippet snippet ffs "form_for submit 2" w -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`${1:f}.submit '${2:Submit}'${3:, :disable_with => '${4:$2ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`${1:f}.submit '${2:Submit}'${3:, disable_with: '${4:$2ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet snippet f. "f_fields_for (nff)" w @@ -84,7 +84,7 @@ snippet f. "f.radio_button" w endsnippet snippet f. "f.submit" w -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.submit "${1:Submit}"${2:, :disable_with => '${3:$1ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.submit "${1:Submit}"${2:, disable_with: '${3:$1ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet snippet f. "f.text_area" w @@ -110,19 +110,19 @@ snippet ff "form_for" w endsnippet snippet ist "image_submit_tag" w -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_submit_tag("${1:agree.png}"${2:${3:, :id => "${4:${1/^(\w+)(\.\w*)?$/$1/}}"}${5:, :name => "${6:${1/^(\w+)(\.\w*)?$/$1/}}"}${7:, :class => "${8:${1/^(\w+)(\.\w*)?$/$1/}-button}"}${9:, :disabled => ${10:false}}})`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_submit_tag("${1:agree.png}"${2:${3:, id: "${4:${1/^(\w+)(\.\w*)?$/$1/}}"}${5:, name: "${6:${1/^(\w+)(\.\w*)?$/$1/}}"}${7:, class: "${8:${1/^(\w+)(\.\w*)?$/$1/}-button}"}${9:, disabled: ${10:false}}})`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet snippet it "image_tag" w -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_tag "$1${2:.png}"${3:${4:, :title => "${5:title}"}${6:, :class => "${7:class}"}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_tag "$1${2:.png}"${3:${4:, title: "${5:title}"}${6:, class: "${7:class}"}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet snippet layout "layout" -layout "${1:template_name}"${2:${3:, :only => ${4:[:${5:action}, :${6:action}]}}${7:, :except => ${8:[:${9:action}, :${10:action}]}}} +layout "${1:template_name}"${2:${3:, only: ${4:[:${5:action}, :${6:action}]}}${7:, except: ${8:[:${9:action}, :${10:action}]}}} endsnippet snippet jit "javascript_include_tag" w -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`javascript_include_tag ${1::all}${2:, :cache => ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`javascript_include_tag ${1::all}${2:, cache: ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet snippet lt "link_to (name, dest)" w @@ -130,23 +130,23 @@ snippet lt "link_to (name, dest)" w endsnippet snippet lia "link_to (action)" w -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :action => "${2:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", action: "${2:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet snippet liai "link_to (action, id)" w -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :action => "${2:edit}", :id => ${3:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", action: "${2:edit}", id: ${3:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet snippet lic "link_to (controller)" w -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :controller => "${2:items}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", controller: "${2:items}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet snippet lica "link_to (controller, action)" w -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :controller => "${2:items}", :action => "${3:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", controller: "${2:items}", action: "${3:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet snippet licai "link_to (controller, action, id)" w -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :controller => "${2:items}", :action => "${3:edit}", :id => ${4:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", controller: "${2:items}", action: "${3:edit}", id: ${4:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet snippet linpp "link_to (nested path plural)" w @@ -174,15 +174,15 @@ page.hide ${1:"${2:id(s)}"} endsnippet snippet ins "page.insert_html (position, id, partial)" -page.insert_html :${1:top}, ${2:"${3:id}"}, :${4:partial => "${5:template}"} +page.insert_html :${1:top}, ${2:"${3:id}"}, ${4:partial: "${5:template}"} endsnippet snippet rep "page.replace (id, partial)" -page.replace ${1:"${2:id}"}, :${3:partial => "${4:template}"} +page.replace ${1:"${2:id}"}, ${3:partial: "${4:template}"} endsnippet snippet reph "page.replace_html (id, partial)" -page.replace_html ${1:"${2:id}"}, :${3:partial => "${4:template}"} +page.replace_html ${1:"${2:id}"}, ${3:partial: "${4:template}"} endsnippet snippet show "page.show (*ids)" @@ -198,31 +198,31 @@ page.visual_effect :${1:toggle_slide}, ${2:"${3:DOM ID}"} endsnippet snippet rp "render (partial) (rp)" -render :partial => "${1:item}" +render partial: "${1:item}" endsnippet snippet rpc "render (partial,collection) (rpc)" -render :partial => "${1:item}", :collection => ${2:@$1s} +render partial: "${1:item}", collection: ${2:@$1s} endsnippet snippet rpl "render (partial,locals) (rpl)" -render :partial => "${1:item}", :locals => { :${2:$1} => ${3:@$1}$0 } +render partial: "${1:item}", locals: { ${2:$1}: ${3:@$1}$0 } endsnippet snippet rpo "render (partial,object) (rpo)" -render :partial => "${1:item}", :object => ${2:@$1} +render partial: "${1:item}", object: ${2:@$1} endsnippet snippet rps "render (partial,status) (rps)" -render :partial => "${1:item}", :status => ${2:500} +render partial: "${1:item}", status: ${2:500} endsnippet snippet slt "stylesheet_link_tag" w -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`stylesheet_link_tag ${1::all}${2:, :cache => ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`stylesheet_link_tag ${1::all}${2:, cache: ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet snippet st "submit_tag" w -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`submit_tag "${1:Save changes}"${2:, :id => "${3:submit}"}${4:, :name => "${5:$3}"}${6:, :class => "${7:form_$3}"}${8:, :disabled => ${9:false}}${10:, :disable_with => "${11:Please wait...}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`submit_tag "${1:Save changes}"${2:, id: "${3:submit}"}${4:, name: "${5:$3}"}${6:, class: "${7:form_$3}"}${8:, disabled: ${9:false}}${10:, disable_with: "${11:Please wait...}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet snippet else "else (ERB)" From 8a0358944c2fc8d2fb4b0a3f93dcb18661f1fd9d Mon Sep 17 00:00:00 2001 From: JeffVenancius <43701418+JeffVenancius@users.noreply.github.com> Date: Fri, 27 Jan 2023 20:11:40 -0300 Subject: [PATCH 27/51] Add files via upload --- snippets/gdscript.snippets | 125 +++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 snippets/gdscript.snippets diff --git a/snippets/gdscript.snippets b/snippets/gdscript.snippets new file mode 100644 index 000000000..e404092ba --- /dev/null +++ b/snippets/gdscript.snippets @@ -0,0 +1,125 @@ +snippet class + class $1 extends ${2:Reference} + \t$3 + + +snippet pr + print($1) + + +snippet ready + func _ready(): + \t${1:pass} + + +snippet init + func _init(): + \t${1:pass} + + +snippet process + func _process(delta): + \t${1:pass} + + +snippet input + func _input(event): + \t${1:pass} + + +snippet inpute + func _input_event(event): + \t${1:pass} + + +snippet draw + func _draw(): + \t${1:pass} + + +snippet guii + func _gui_input(event): + \t${1:pass} + + +snippet for + for $1 in $2: + \t${3:pass} + + +snippet for + for $1 in range(${2:start}{$3:,end}): + \t${4:pass} + + +snippet if + if ${1:condition}: + \t${3:pass} + elif ${2:condition}: + \t${4:pass} + else: + \t${5:pass} + + +snippet if + if ${1:condition}: + \t${2:pass} + else: + \t${3:pass} + + +snippet if + if ${1:condition}: + \t${2:pass} + + +snippet while + while ${1:condition}: + \t${2:pass} + + +snippet func + func ${1:method}(${2:args}): + \t${3:pass} + + +snippet signal + signal ${1:signalname}(${2:args}) + + +snippet export + export(${1:type}${2:,other_configs}) var ${3:name}${4: = default}${5: setget } + + +snippet var + var ${1:name}${2: = default}${3: setget } + + +snippet onready + onready var ${1:name} = get_node($2) + + +snippet is + ${1:instance} is ${2:class} + + +snippet in + ${1:element} in ${$2:array} + + +snippet gdscript + extends ${1:BaseClass} + + # class member variables go here, for example: + # var a = 2 + # var b = \textvar\ + + func _ready(): + \t# Called every time the node is added to the scene. + \t# Initialization here + \tpass + + + +# snippet pass ##### do we really need this? +# pass From 8f9eead6c4dfdfee9052d4ea667c1c9d8a396f80 Mon Sep 17 00:00:00 2001 From: sharils <3063067+sharils@users.noreply.github.com> Date: Fri, 27 Jan 2023 16:33:22 +0800 Subject: [PATCH 28/51] Fix UltiSnips " trigger closing quote expansion --- UltiSnips/python.snippets | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/UltiSnips/python.snippets b/UltiSnips/python.snippets index dc5761af2..a47544117 100644 --- a/UltiSnips/python.snippets +++ b/UltiSnips/python.snippets @@ -127,14 +127,18 @@ def triple_quotes_handle_trailing(snip, quoting_style): if not snip.c: # Do this only once, otherwise the following error would happen: # RuntimeError: The snippets content did not converge: … - _, col = vim.current.window.cursor - line = vim.current.line + row, col = vim.current.window.cursor + + # before ultisnip expansion, chars ahead cursor is at row - 1, col + # after ultisnip expansion, they are pushed to row + 1, col - 1 + # when this function is run, it's already after ultisni expansion + line = snip.buffer[row + 1] # Handle already existing quote chars after the trigger. _ret = quoting_style * 3 while True: try: - nextc = line[col] + nextc = line[col - 1] except IndexError: break if nextc == quoting_style and len(_ret): From 68dfbccbe97b87ec9c80fa6d5ee144befc3f3a3b Mon Sep 17 00:00:00 2001 From: Max Gorin Date: Mon, 13 Feb 2023 14:40:14 +0530 Subject: [PATCH 29/51] Support heex filetype --- snippets/heex.snippets | 1 + 1 file changed, 1 insertion(+) create mode 100644 snippets/heex.snippets diff --git a/snippets/heex.snippets b/snippets/heex.snippets new file mode 100644 index 000000000..41cc260a4 --- /dev/null +++ b/snippets/heex.snippets @@ -0,0 +1 @@ +extends eelixir From 7fe13029e96dcfe48626d6cdaab2249e42e3eefd Mon Sep 17 00:00:00 2001 From: Iwakura Taro Date: Sun, 5 Mar 2023 10:42:50 +0200 Subject: [PATCH 30/51] Method with memoization --- snippets/ruby.snippets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 95de362e2..668194abe 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -44,6 +44,10 @@ snippet def def ${1:method_name} ${0} end +snippet defm + def ${1:method} + @$1 ||= ${0} + end snippet deft def test_${1:case_name} ${0} From c7e61b73a546c9dd0525cd158cc1613bb48e414a Mon Sep 17 00:00:00 2001 From: Iwakura Taro Date: Sun, 5 Mar 2023 10:43:57 +0200 Subject: [PATCH 31/51] Rejecting lines like `grep -v` --- snippets/ruby.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 668194abe..da82185a3 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -376,6 +376,8 @@ snippet finad end snippet gre grep(${1:/pattern/}) { |${2:match}| ${0} } +snippet grepv + select { |${1:line}| $1 !~ ${2:/pattern/} }${0} snippet sub ${1:g}sub(${2:/pattern/}) { |${3:match}| ${0} } snippet sca From 5094d3658023cf743379f45c4c34bcc0a39ca4a2 Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Tue, 25 Apr 2023 20:00:10 +0100 Subject: [PATCH 32/51] TeX: remove spurious line breaks --- snippets/tex.snippets | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/snippets/tex.snippets b/snippets/tex.snippets index 25f8f37f7..3dddd184a 100644 --- a/snippets/tex.snippets +++ b/snippets/tex.snippets @@ -390,63 +390,48 @@ snippet hrefc # enquote from package csquotes snippet enq enquote \\enquote{${1:${VISUAL:text}}} ${0} - # Time derivative snippet ddt time derivative \\frac{d}{dt} {$1} {$0} - # Limit snippet lim limit \\lim_{{$1}} {{$2}} {$0} - # Partial derivative snippet pdv partial derivation \\frac{\\partial {$1}}{\\partial {$2}} {$0} - # Second order partial derivative snippet ppdv second partial derivation \\frac{\\partial^2 {$1}}{\\partial {$2} \\partial {$3}} {$0} - # Ordinary derivative snippet dv derivative \\frac{d {$1}}{d {$2}} {$0} - # Summation snippet summ summation \\sum_{{$1}} {$0} - # Shorthand for time derivative snippet dot dot \\dot{{$1}} {$0} - # Shorthand for second order time derivative snippet ddot ddot \\ddot{{$1}} {$0} - # Vector snippet vec vector \\vec{{$1}} {$0} - # Bar snippet bar bar \\bar{{$1}} {$0} - # Cross product snippet \x cross product \\times {$0} - # Dot product snippet . dot product \\cdot {$0} - # Integral snippet int integral \\int_{{$1}}^{{$2}} {$3} \\: d{$4} {$0} - # Right arrow snippet ra rightarrow \\rightarrow {$0} - # Long right arrow snippet lra longrightarrow \\longrightarrow {$0} From 76e35f37aa9e47a8b7f2909de222844ae38c7007 Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Sun, 11 Sep 2022 20:36:47 +0100 Subject: [PATCH 33/51] Qualifying Range-v3 and C++20's entities; ad-hoc snippet for transform and filter I find myself very frequently writing `ranges::views::`, and I'd be doing the same with `std::views::` if I was using C++20, so I think this snippets can be useful. `transform` and `filter` are two of the most used adapters, so haveing a snippet for them is good (for both `std::` and `ranges::`, at the price of a backspace). --- snippets/cpp.snippets | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index 4e4155a82..3bd1f001a 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -230,3 +230,24 @@ snippet af auto function { ${0} }; +# Range-v3 transform +snippet transform "ranges::views::transform" + ${1:${2:std::}${3:ranges::}views::}transform($4) +# Range-v3 transform +snippet filter "ranges::views::filter" + ${1:${2:std::}${3:ranges::}views::}filter($4) +# Range-v3 ranges:: +snippet r "ranges::" + ranges:: +# Range-v3 ranges::views:: +snippet rv "ranges::views::" + ranges::views:: +# Range-v3 ranges::actions:: +snippet ra "ranges::actions::" + ranges::actions:: +# STL std::ranges:: +snippet sr "std::ranges::" + std::ranges:: +# STL std::views:: +snippet sv "std::views::" + std::views:: From 845798bbebe893dcb0c8ebfb40be778433db7ba4 Mon Sep 17 00:00:00 2001 From: r3jack Date: Wed, 23 Aug 2023 14:29:26 +0800 Subject: [PATCH 34/51] add dart print and anonymous function snippets --- snippets/dart.snippets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snippets/dart.snippets b/snippets/dart.snippets index f4fd4f13e..462b5e390 100644 --- a/snippets/dart.snippets +++ b/snippets/dart.snippets @@ -1,3 +1,7 @@ +snippet af + (${1}) {${2}}${0} +snippet pr + print(${1}); snippet lib library ${1}; ${0} From d37486881a0a771b844a235bc3e025046088690d Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Thu, 24 Aug 2023 23:54:30 +0100 Subject: [PATCH 35/51] Remove redundant empty line after #include snippets for C --- snippets/c.snippets | 2 -- 1 file changed, 2 deletions(-) diff --git a/snippets/c.snippets b/snippets/c.snippets index df5595b9e..a3f4d5c99 100644 --- a/snippets/c.snippets +++ b/snippets/c.snippets @@ -16,11 +16,9 @@ snippet mainn # #include <...> snippet inc #include <${1:stdio}.h> - $0 # #include "..." snippet Inc #include "${1:`vim_snippets#Filename("$1.h")`}" - $0 # ifndef...define...endif snippet ndef #ifndef $1 From 175081434cfee0727b1601d954022eb48490a1cc Mon Sep 17 00:00:00 2001 From: jack Date: Mon, 4 Sep 2023 15:19:04 +0800 Subject: [PATCH 36/51] add debugger to dart --- snippets/dart.snippets | 3 +++ 1 file changed, 3 insertions(+) diff --git a/snippets/dart.snippets b/snippets/dart.snippets index 462b5e390..30ab3d5d8 100644 --- a/snippets/dart.snippets +++ b/snippets/dart.snippets @@ -2,6 +2,9 @@ snippet af (${1}) {${2}}${0} snippet pr print(${1}); +snippet deb + debugger(); + ${0} snippet lib library ${1}; ${0} From ccc2fa1529d372f7ac16d5eb07a385a72b50e05d Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Mon, 11 Sep 2023 21:08:16 +0100 Subject: [PATCH 37/51] Scheme: remove redundant tab --- snippets/scheme.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/scheme.snippets b/snippets/scheme.snippets index 4c0c78a09..0aa137945 100644 --- a/snippets/scheme.snippets +++ b/snippets/scheme.snippets @@ -17,7 +17,7 @@ snippet * # Definition snippet def (define (${1:name}) - ${0:definition}) + ${0:definition}) # Definition with lambda snippet defl From dd5477668e472d5f39d4b5545f1e269168509ffd Mon Sep 17 00:00:00 2001 From: HBSpy Date: Tue, 31 Oct 2023 11:39:52 +0800 Subject: [PATCH 38/51] Update php.snippets --- UltiSnips/php.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets index f27ac8be5..7db6bead6 100644 --- a/UltiSnips/php.snippets +++ b/UltiSnips/php.snippets @@ -6,7 +6,7 @@ import vim # Set g:ultisnips_php_scalar_types to 1 if you'd like to enable PHP 7's scalar types for return values def isPHPScalarTypesEnabled(): isEnabled = vim.eval("get(g:, 'ultisnips_php_scalar_types', 0)") == "1" - return isEnabled or re.match('<\?php\s+declare\(strict_types=[01]\);', '\n'.join(vim.current.window.buffer)) + return isEnabled or re.match('r<\?php\s+declare\(strict_types=[01]\);', '\n'.join(vim.current.window.buffer)) endglobal ## Snippets from SnipMate, taken from From b039190177d97a968d80518470910aae7faf182a Mon Sep 17 00:00:00 2001 From: HBSpy Date: Wed, 1 Nov 2023 16:56:18 +0800 Subject: [PATCH 39/51] Update php.snippets sorry to make a mistake in the last pr --- UltiSnips/php.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets index 7db6bead6..def1ca4da 100644 --- a/UltiSnips/php.snippets +++ b/UltiSnips/php.snippets @@ -6,7 +6,7 @@ import vim # Set g:ultisnips_php_scalar_types to 1 if you'd like to enable PHP 7's scalar types for return values def isPHPScalarTypesEnabled(): isEnabled = vim.eval("get(g:, 'ultisnips_php_scalar_types', 0)") == "1" - return isEnabled or re.match('r<\?php\s+declare\(strict_types=[01]\);', '\n'.join(vim.current.window.buffer)) + return isEnabled or re.match(r'<\?php\s+declare\(strict_types=[01]\);', '\n'.join(vim.current.window.buffer)) endglobal ## Snippets from SnipMate, taken from From 5bde67f3c26eaad06d047f3582c1d3a57a3d41e2 Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Wed, 22 Nov 2023 16:46:25 +0000 Subject: [PATCH 40/51] feat(tex): de-duplicate snippets Remove from ultisnips those that are already defined in snipmate format --- UltiSnips/tex.snippets | 188 ----------------------------------------- snippets/tex.snippets | 10 +++ 2 files changed, 10 insertions(+), 188 deletions(-) diff --git a/UltiSnips/tex.snippets b/UltiSnips/tex.snippets index 393b3eee9..69d86f443 100644 --- a/UltiSnips/tex.snippets +++ b/UltiSnips/tex.snippets @@ -36,24 +36,6 @@ endglobal # ENVIRONMENT # ############### -snippet beg "begin{} / end{}" bi -\begin{$1} - ${0:${VISUAL}} -\end{$1} -endsnippet - -snippet cnt "Center" bi -\begin{center} - ${0:${VISUAL}} -\end{center} -endsnippet - -snippet desc "Description" bi -\begin{description} - \item[${1:${VISUAL}}] $0 -\end{description} -endsnippet - snippet lemma "Lemma" bi \begin{lemma} ${0:${VISUAL}} @@ -135,24 +117,6 @@ snippet fig "Figure environment" bi \end{figure} endsnippet -snippet enum "Enumerate" bi -\begin{enumerate} - \item ${0:${VISUAL}} -\end{enumerate} -endsnippet - -snippet item "Itemize" bi -\begin{itemize} - \item ${0:${VISUAL}} -\end{itemize} -endsnippet - -snippet case "cases" bi -\begin{cases} - ${0:${VISUAL}} -\end{cases} -endsnippet - snippet abs "abstract environment" b \begin{abstract} ${0:${VISUAL}} @@ -247,26 +211,6 @@ snippet srto "... Root" wi \sqrt[$1]{${2:${VISUAL}}}$0 endsnippet -snippet bf "Bold" wi -\bf{${1:${VISUAL}}}$0 -endsnippet - -snippet it "Italic" wi -\it{${1:${VISUAL}}}$0 -endsnippet - -snippet un "Underline" wi -\un{${1:${VISUAL}}}$0 -endsnippet - -snippet rm "Text" wi -\rm{${1:${VISUAL}}}$0 -endsnippet - -snippet itm "Item" wi -\item ${0:${VISUAL}} -endsnippet - snippet ceil "Ceil" w \left\lceil $1 \right\rceil $0 endsnippet @@ -283,34 +227,10 @@ snippet bmat "Bmat" w \begin{bmatrix} $1 \end{bmatrix} $0 endsnippet -snippet () "Left( right)" w -\left( ${1:${VISUAL}} \right) $0 -endsnippet - -snippet lr "left( right)" i -\left( ${1:${VISUAL}} \right) $0 -endsnippet - -snippet lr( "left( right)" i -\left( ${1:${VISUAL}} \right) $0 -endsnippet - -snippet lr| "left| right|" i -\left| ${1:${VISUAL}} \right| $0 -endsnippet - -snippet lr{ "left\{ right\}" i -\left\\{ ${1:${VISUAL}} \right\\} $0 -endsnippet - snippet lrb "left\{ right\}" i \left\\{ ${1:${VISUAL}} \right\\} $0 endsnippet -snippet lr[ "left[ right]" i -\left[ ${1:${VISUAL}} \right] $0 -endsnippet - snippet lra "leftangle rightangle" wi \left<${1:${VISUAL}} \right>$0 endsnippet @@ -467,112 +387,4 @@ snippet ac "Acroynm normal" bi \ac{${1:acronym}} endsnippet -snippet ni "Non-indented paragraph" bi -\noindent -endsnippet - - -############ -# SECTIONS # -############ - -snippet chap "Chapter" wi -\chapter{$1${VISUAL}} -endsnippet - -snippet sec "Section" wi -\section{$1${VISUAL}} -endsnippet - -snippet sec* "Section*" wi -\section*{$1${VISUAL}} -endsnippet - -snippet sub "Subsection" wi -\subsection{$1${VISUAL}} -endsnippet - -snippet sub* "Subsection*" wi -\subsection*{$1${VISUAL}} -endsnippet - -snippet subsub "Subsection" wi -\subsubsection{$1${VISUAL}} -endsnippet - -snippet subsub* "Subsubsection" wi -\subsubsection*{$1${VISUAL}} -endsnippet - -snippet par "Paragraph" wi -\paragraph{$1${VISUAL}} -endsnippet - -snippet par* "Paragraph*" wi -\paragraph*{$1${VISUAL}} -endsnippet - -snippet subpar "Sub Paragraph" wi -\subparagraph{$1${VISUAL}} -endsnippet - -snippet subpar* "Sub Paragraph*" wi -\subparagraph*{$1${VISUAL}} -endsnippet - -snippet chapl "Chapter with label" wi -\chapter{$1${VISUAL}} -\label{cha:${2:${1/\W+/-/g}}} -endsnippet - -snippet secl "Section with label" wi -\section{$1${VISUAL}} -\label{sec:${2:${1/\W+/-/g}}} -endsnippet - -snippet sec*l "Section* with label" wi -\section*{$1${VISUAL}} -\label{sec:${2:${1/\W+/-/g}}} -endsnippet - -snippet subl "Subsection with label" wi -\subsection{$1${VISUAL}} -\label{sub:${2:${1/\W+/-/g}}} -endsnippet - -snippet sub*l "Subsection* with label" wi -\subsection*{$1${VISUAL}} -\label{sub:${2:${1/\W+/-/g}}} -endsnippet - -snippet subsubl "Subsection with label" wi -\subsubsection{$1${VISUAL}} -\label{ssub:${2:${1/\W+/-/g}}} -endsnippet - -snippet subsub*l "Subsubsection with label" wi -\subsubsection*{$1${VISUAL}} -\label{ssub:${2:${1/\W+/-/g}}} -endsnippet - -snippet parl "Paragraph with label" wi -\paragraph{$1${VISUAL}} -\label{par:${2:${1/\W+/-/g}}} -endsnippet - -snippet par*l "Paragraph* with label" wi -\paragraph*{$1${VISUAL}} -\label{par:${2:${1/\W+/-/g}}} -endsnippet - -snippet subparl "Sub Paragraph with label" wi -\subparagraph{$1${VISUAL}} -\label{subp:${2:${1/\W+/-/g}}} -endsnippet - -snippet subpar*l "Sub Paragraph* with label" wi -\subparagraph*{$1${VISUAL}} -\label{subp:${2:${1/\W+/-/g}}} -endsnippet - # vim:ft=snippets: diff --git a/snippets/tex.snippets b/snippets/tex.snippets index 3dddd184a..4d54fe011 100644 --- a/snippets/tex.snippets +++ b/snippets/tex.snippets @@ -195,11 +195,21 @@ snippet par \paragraph \\paragraph{${1:paragraph name}}% \\label{par:${2:$1}} ${0} +# Paragraph* +snippet par* \paragraph* + \\paragraph*{${1:paragraph name}}% + \\label{par:${2:$1}} + ${0} # Sub Paragraph snippet subp \subparagraph \\subparagraph{${1:subparagraph name}}% \\label{subp:${2:$1}} ${0} +# Sub Paragraph* +snippet subp* \subparagraph* + \\subparagraph*{${1:subparagraph name}}% + \\label{subp:${2:$1}} + ${0} snippet ni \noindent \\noindent ${0} From 2ed3a7359f8fcb2b4c06b8c3ba2d0663158f6f09 Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Mon, 27 Nov 2023 11:51:47 +0000 Subject: [PATCH 41/51] chore(readme): note that snipmate contributions should be preferred since UltiSnips supports both --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index a54c31342..8cf06c4b8 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,9 @@ on the fly adding those. Currently all snippets from UltiSnips have been put into `/UltiSnips` - some work on merging should be done (dropping duplicates etc). Also see engines section above. +Since UltiSnips supports both UltiSnip and vim-snipmate snippets, when +contributing fixes/new snippets, please prefer adding vim-snipmate snippets. + Related repositories -------------------- From ec4ff7e9c9b274e93295924e59c82b4f51e2ae42 Mon Sep 17 00:00:00 2001 From: Harris Date: Tue, 28 Nov 2023 11:03:19 +0800 Subject: [PATCH 42/51] Update vimsnippets.py to fix the escape char issue --- pythonx/vimsnippets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonx/vimsnippets.py b/pythonx/vimsnippets.py index eceb83c5b..68b430e44 100644 --- a/pythonx/vimsnippets.py +++ b/pythonx/vimsnippets.py @@ -14,7 +14,7 @@ def complete(tab, opts): :return: a string that match with tab """ el = [x for x in tab] - pat = "".join(list(map(lambda x: x + "\w*" if re.match("\w", x) else x, + pat = "".join(list(map(lambda x: x + r"\w*" if re.match(r"\w", x) else x, el))) try: opts = [x for x in opts if re.search(pat, x, re.IGNORECASE)] From a8dc763b3f534ec1a0c0ae5082689c10dcaf9d5f Mon Sep 17 00:00:00 2001 From: Alexander Shirokov Date: Mon, 11 Dec 2023 09:44:01 +0100 Subject: [PATCH 43/51] Add GTest support Add a small set of frequently used GTest macros --- snippets/cpp.snippets | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index 3bd1f001a..bb9528a6f 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -251,3 +251,29 @@ snippet sr "std::ranges::" # STL std::views:: snippet sv "std::views::" std::views:: +## +## Tests +# GTest:add main +snippet gtemain "GTest:add main" + int main(int argc, char **argv) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); + } +# GTest:add test +snippet gtetest "GTest:add test" + TEST(${1:SuiteName}, ${2:TestName}) { + ${0} + } +# GTest:add fixture +snippet gtefix "GTest:add fixture" + TEST_F(${1:SuiteName}, ${2:TestName}) { + ${0} + } +# GTest:add parameterized test +snippet gtepar "GTest:add parameterized test" + TEST_P(${1:SuiteName}, ${2:TestName}) { + ${0} + } +# GTest:instantiate parameterized test +snippet gteparins "GTest:instantiate parameterized test" + INSTANTIATE_TEST_SUITE_P(${1:InstantiationName}, ${2:SuiteName}, ${0}); From ba72b08e04e184ecd0a2a1b8012a81ddb040dbc3 Mon Sep 17 00:00:00 2001 From: Harvey Date: Fri, 29 Dec 2023 15:52:57 +0800 Subject: [PATCH 44/51] fix the escape issue with python 3.12.0 --- UltiSnips/java.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/java.snippets b/UltiSnips/java.snippets index 55883a365..9c7ed8208 100644 --- a/UltiSnips/java.snippets +++ b/UltiSnips/java.snippets @@ -21,7 +21,7 @@ def nl(snip): snip.rv += " " def getArgs(group): import re - word = re.compile('[a-zA-Z0-9><.]+ \w+') + word = re.compile(r'[a-zA-Z0-9><.]+ \w+') return [i.split(" ") for i in word.findall(group) ] def camel(word): From 75cd3fd2a22b8d6eefd553f386e0705e7d2cd4a6 Mon Sep 17 00:00:00 2001 From: AlvinRolling Date: Wed, 17 Jan 2024 18:41:02 +0800 Subject: [PATCH 45/51] Universal Verification Methodology (UVM) Snippets. --- snippets/systemverilog.snippets | 591 ++++++++++++++++++++++++++++++++ 1 file changed, 591 insertions(+) diff --git a/snippets/systemverilog.snippets b/snippets/systemverilog.snippets index f510750d6..828a6de9c 100644 --- a/snippets/systemverilog.snippets +++ b/snippets/systemverilog.snippets @@ -71,3 +71,594 @@ snippet pkg package ${1:package_name}; ${0} endpackage : $1 + +snippet uvm_object + // Class: $1 + // + class ${1:my_class} extends ${2:uvm_object}; + \`uvm_object_utils($1); + + // Group: Variables + + + // Group: Constraints + + + // Group: Functions + + // Constructor: new + function new(string name = "$1"); + super.new(name); + endfunction: new + $0 + endclass: $1 + + +snippet uvm_object_with_parameters + // Class: $1 + // + class ${1:my_class} #(${2:parameters}) extends ${3:uvm_object}; + typedef $1 #(${2/(\b(parameter|type)\s+([A-Za-z_][A-Za-z0-9_$]*)(\s*=\s*([A-Za-z0-9_$]+))?)*\b/$3/g}) this_type_t; + \`uvm_object_param_utils(this_type_t); + + // Group: Variables + + + // Group: Constraints + + + // Group: Functions + + // Constructor: new + function new(string name = "$1"); + super.new(name); + endfunction: new + $0 + endclass: $1 + + +snippet uvm_component + // Class: $1 + // + class ${1:my_class} extends ${2:uvm_component}; + \`uvm_component_utils($1); + + // Group: Configuration Object(s) + + // Var: config_obj + ${3:config_obj_t} config_obj; + + + // Group: Components + + + // Group: Variables + + + // Group: Functions + + // Constructor: new + function new(string name = "$1", uvm_component parent); + super.new(name, parent); + endfunction: new + + $0 + endclass: $1 + + +snippet uvm_component_with_parameters + // Class: $1 + // + class ${1:my_class} #(${2:parameters}) extends ${3:uvm_component}; + typedef $1 #(${2/(\b(parameter|type)\s+([A-Za-z_][A-Za-z0-9_$]*)(\s*=\s*([A-Za-z0-9_$]+))?)*\b/$3/g}) this_type_t; + \`uvm_component_param_utils(this_type_t); + + // Group: Configuration Object(s) + + // Var: config_obj + ${4:config_obj_t} config_obj; + + + // Group: Components + + + // Group: Variables + + + // Constructor: new + function new(string name = "$1", uvm_component parent); + super.new(name, parent); + endfunction: new + + $0 + endclass: $1 + + +snippet uvm_component_extended + // Class: $1 + // + class ${1:my_class} extends ${2:base_class}; + \`uvm_component_utils($1); + + // Group: Configuration Object(s) + + + // Group: Components + + + // Group: Variables + + + // Group: Functions + + // Constructor: new + function new(string name = "$1", uvm_component parent); + super.new(name, parent); + endfunction: new + + /*--- UVM Build Phases ---*/ + /*------------------------------------*/ + // Function: build_phase + extern function void build_phase(uvm_phase phase); + // Function: connect_phase + extern function void connect_phase(uvm_phase phase); + // Function: end_of_elaboration_phase + extern function void end_of_elaboration_phase(uvm_phase phase); + + /*--- UVM Run Phases ---*/ + /*------------------------------------*/ + // Function: start_of_simulation_phase + extern function void start_of_simulation_phase(uvm_phase phase); + // Function: reset_phase + extern task reset_phase(uvm_phase phase); + // Function: configure_phase + extern task configure_phase(uvm_phase phase); + // Function: main_phase + extern task main_phase(uvm_phase phase); + // Function: shutdown_phase + extern task shutdown_phase(uvm_phase phase); + + /*--- UVM Cleanup Phases ---*/ + /*------------------------------------*/ + // Function: extract_phase + extern function void extract_phase(uvm_phase phase); + // Function: report_phase + extern function void report_phase(uvm_phase phase); + $0 + endclass: $1 + + + /*----------------------------------------------------------------------------*/ + /* UVM Build Phases */ + /*----------------------------------------------------------------------------*/ + function void $1::build_phase(uvm_phase phase); + /* note: Do not call super.build_phase() from any class that is extended from an UVM base class! */ + /* For more information see UVM Cookbook v1800.2 p.503 */ + // super.build_phase(phase); + endfunction: build_phase + + + function void $1::connect_phase(uvm_phase phase); + super.connect_phase(phase); + endfunction: connect_phase + + + function void $1::end_of_elaboration_phase(uvm_phase phase); + super.end_of_elaboration_phase(phase); + endfunction: end_of_elaboration_phase + + + /*----------------------------------------------------------------------------*/ + /* UVM Run Phases */ + /*----------------------------------------------------------------------------*/ + function void $1::start_of_simulation_phase(uvm_phase phase); + super.start_of_simulation_phase(phase); + endfunction: start_of_simulation_phase + + + task $1::reset_phase(uvm_phase phase); + endtask: reset_phase + + + task $1::configure_phase(uvm_phase phase); + endtask: configure_phase + + + task $1::main_phase(uvm_phase phase); + endtask: main_phase + + + task $1::shutdown_phase(uvm_phase phase); + endtask: shutdown_phase + + + /*----------------------------------------------------------------------------*/ + /* UVM Cleanup Phases */ + /*----------------------------------------------------------------------------*/ + function void $1::report_phase(uvm_phase phase); + super.report_phase(phase); + endfunction: report_phase + + + function void $1::extract_phase(uvm_phase phase); + super.extract_phase(phase); + endfunction: extract_phase + + + +snippet uvm_sequence + // Class: $1 + // + class ${1:my_class} extends ${2:uvm_sequence}; + \`uvm_object_utils($1); + + // Group: Variables + + + // Group: Constraints + + + // Group: Functions + + // Constructor: new + function new(string name = "$1"); + super.new(name); + endfunction: new + + // Task: pre_start + // This task is a user-definable callback that is called before the optional + // execution of . + // extern virtual task pre_start(); + + // Task: pre_body + // This task is a user-definable callback that is called before the execution + // of ~only~ when the sequence is started with . + // If is called with ~call_pre_post~ set to 0, ~pre_body~ is not called. + // extern virtual task pre_body(); + + // Task: pre_do + // This task is a user-definable callback task that is called ~on the parent + // sequence~, if any. The sequence has issued a wait_for_grant() call and after + // the sequencer has selected this sequence, and before the item is randomized. + // + // Although pre_do is a task, consuming simulation cycles may result in unexpected + // behavior on the driver. + // extern virtual task pre_do(bit is_item); + + // Function: mid_do + // This function is a user-definable callback function that is called after the + // sequence item has been randomized, and just before the item is sent to the + // driver. + // extern virtual function void mid_do(uvm_sequence_item this_item); + + // Task: body + // This is the user-defined task where the main sequence code resides. + extern virtual task body(); + + // Function: post_do + // This function is a user-definable callback function that is called after the + // driver has indicated that it has completed the item, using either this + // item_done or put methods. + // extern virtual function void post_do(uvm_sequence_item this_item); + + // Task: post_body + // This task is a user-definable callback task that is called after the execution + // of ~only~ when the sequence is started with . + // If is called with ~call_pre_post~ set to 0, ~post_body~ is not called. + // extern virtual task post_body(); + + // Task: post_start + // This task is a user-definable callback that is called after the optional + // execution of . + // extern virtual task post_start(); + $0 + endclass: $1 + +snippet uvm_sequence_with_parameters + // Class: $1 + // + class ${1:my_class} #(${2:parameters}) extends ${3:uvm_sequence}; + typedef $1 #(${2/(\b(parameter|type)\s+([A-Za-z_][A-Za-z0-9_$]*)(\s*=\s*([A-Za-z0-9_$]+))?)*\b/$3/g}) this_type_t; + \`uvm_object_param_utils(this_type_t); + + // Group: Variables + + + // Group: Constraints + + + // Group: Functions + + // Constructor: new + function new(string name = "$1"); + super.new(name); + endfunction: new + + // Task: pre_start + // This task is a user-definable callback that is called before the optional + // execution of . + // extern virtual task pre_start(); + + // Task: pre_body + // This task is a user-definable callback that is called before the execution + // of ~only~ when the sequence is started with . + // If is called with ~call_pre_post~ set to 0, ~pre_body~ is not called. + // extern virtual task pre_body(); + + // Task: pre_do + // This task is a user-definable callback task that is called ~on the parent + // sequence~, if any. The sequence has issued a wait_for_grant() call and after + // the sequencer has selected this sequence, and before the item is randomized. + // + // Although pre_do is a task, consuming simulation cycles may result in unexpected + // behavior on the driver. + // extern virtual task pre_do(bit is_item); + + // Function: mid_do + // This function is a user-definable callback function that is called after the + // sequence item has been randomized, and just before the item is sent to the + // driver. + // extern virtual function void mid_do(uvm_sequence_item this_item); + + // Task: body + // This is the user-defined task where the main sequence code resides. + extern virtual task body(); + + // Function: post_do + // This function is a user-definable callback function that is called after the + // driver has indicated that it has completed the item, using either this + // item_done or put methods. + // extern virtual function void post_do(uvm_sequence_item this_item); + + // Task: post_body + // This task is a user-definable callback task that is called after the execution + // of ~only~ when the sequence is started with . + // If is called with ~call_pre_post~ set to 0, ~post_body~ is not called. + // extern virtual task post_body(); + + // Task: post_start + // This task is a user-definable callback that is called after the optional + // execution of . + // extern virtual task post_start(); + $0 + endclass: $1 + +snippet uvm_sequence_functions + // task ${1:my_class::}pre_start(); + // endtask: pre_start + + + // task $1pre_body(); + // endtask: pre_body + + + // task $1pre_do(bit is_item); + // endtask: pre_do + + + // function void $1mid_do(uvm_sequence_item this_item); + // endfunction: mid_do + + + task $1body(); + $0 + endtask: body + + + // function void $1post_do(uvm_sequence_item this_item); + // endfunction: post_do + + + // task $1post_body(); + // endtask: post_body + + + // task $1post_start(); + // endtask: post_start + + +snippet uvm_sequence_item + // Class: $1 + // + class ${1:my_class} extends ${2:uvm_sequence_item}; + typedef $1 this_type_t; + \`uvm_object_utils($1); + + // Group: Variables + + + // Group: Constraints + + + // Group: Functions + + // Constructor: new + function new(string name = "$1"); + super.new(name); + endfunction: new + + // Function: do_copy + // extern function void do_copy(uvm_object rhs); + // Function: do_compare + // extern function bit do_compare(uvm_object rhs, uvm_comparer comparer); + // Function: convert2string + // extern function string convert2string(); + // Function: do_print + // extern function void do_print(uvm_printer printer); + // Function: do_record + // extern function void do_record(uvm_recorder recorder); + // Function: do_pack + // extern function void do_pack(); + // Function: do_unpack + // extern function void do_unpack(); + $0 + endclass: $1 + + + /*----------------------------------------------------------------------------*/ + /* Constraints */ + /*----------------------------------------------------------------------------*/ + + + + + /*----------------------------------------------------------------------------*/ + /* Functions */ + /*----------------------------------------------------------------------------*/ + + + +snippet uvm_sequence_item_with_parameters + // Class: $1 + // + class ${1:my_class} #(${2:parameters}) extends ${3:uvm_sequence_item}; + typedef $1 #(${2/(\b(parameter|type)\s+([A-Za-z_][A-Za-z0-9_$]*)(\s*=\s*([A-Za-z0-9_$]+))?)*\b/$3/g}) this_type_t; + \`uvm_object_param_utils(this_type_t); + + // Group: Variables + + + // Group: Constraints + + + // Group: Functions + + // Constructor: new + function new(string name = "$1"); + super.new(name); + endfunction: new + + // Function: do_copy + // extern function void do_copy(uvm_object rhs); + // Function: do_compare + // extern function bit do_compare(uvm_object rhs, uvm_comparer comparer); + // Function: convert2string + // extern function string convert2string(); + // Function: do_print + // extern function void do_print(uvm_printer printer); + // Function: do_record + // extern function void do_record(uvm_recorder recorder); + // Function: do_pack + // extern function void do_pack(); + // Function: do_unpack + // extern function void do_unpack(); + $0 + endclass: $1 + + + /*----------------------------------------------------------------------------*/ + /* Constraints */ + /*----------------------------------------------------------------------------*/ + + + + + /*----------------------------------------------------------------------------*/ + /* Functions */ + /*----------------------------------------------------------------------------*/ + + + +snippet uvm_sequence_item_do_copy + function void ${1:my_class}${2:::}do_copy(uvm_object rhs); + this_type_t rhs_; + + if (!\$cast(rhs_, rhs)) begin + \`uvm_error({this.get_name(), ".do_copy()"}, "Cast failed!"); + return; + end + // \`uvm_info({this.get_name(), ".do_copy()"}, "Cast succeded.", UVM_HIGH); + + /* chain the copy with parent classes */ + super.do_copy(rhs); + + /* list of local properties to be copied */ + // ; + endfunction: do_copy$0 + + + +snippet uvm_sequence_item_do_compare + function bit ${1:my_class}${2:::}do_compare(uvm_object rhs, uvm_comparer comparer); + this_type_t rhs_; + + if (!\$cast(rhs_, rhs)) begin + \`uvm_error({this.get_name(), ".do_compare()"}, "Cast failed!"); + return; + end + // \`uvm_info({this.get_name(), ".do_compare()"}, "Cast succeded.", UVM_HIGH); + + /* chain the compare with parent classes */ + do_compare = super.do_compare(rhs, comparer); + + /* list of local properties to be compared: */ + do_compare &= ( + // && + // + ); + endfunction: do_compare$0 + + + +snippet uvm_sequence_item_convert2string + function string ${1:my_class}${2:::}convert2string(); + string s; + + /* chain the convert2string with parent classes */ + s = super.convert2string(); + + /* list of local properties to be printed: */ + // guide 0---4---8--12--16--20--24--28--32--36--40--44--48-- + // s = {s, \$sformatf("property_label : 0x%0h\n", property_name)}; + // s = {s, \$sformatf("property_label : %0d\n", property_name)}; + + return s; + endfunction: convert2string$0 + + + +snippet uvm_sequence_item_do_print + function void ${1:my_class}${2:::}do_print(uvm_printer printer) + /* chain the print with parent classes */ + super.do_print(printer); + + /* list of local properties to be printed: */ + // printer.print_string("property_label", property_name); + // printer.print_field_int("property_label", property_name, \$bits(property_name), UVM_HEX); + endfunction: do_print$0 + +snippet uvm_sequence_item_do_record + function void ${1:my_class}${2:::}do_record(uvm_recorder recorder); + /* chain the record with parent classes */ + super.do_record(recorder); + + /* list of local properties to be recorded: */ + /* note: use uvm_record_int, uvm_record_string, uvm_record_time, uvm_record_real for known basic types. */ + // \`uvm_record_string("property_label", property_name); + // \`uvm_record_int("property_label", property_name, \$bits(property_name), UVM_HEX); + endfunction: do_record$0 + +snippet uvm_sequence_item_do_pack + function void ${1:my_class}${2:::}do_pack(uvm_packer packer); + /* chain the pack with parent classes */ + super.do_pack(packer); + + /* list of local properties to be packed: */ + // note: look up the appropriate macro(s) for your properties! + // \`uvm_pack_int(property_name); + // \`uvm_pack_queue(property_name); + // \`uvm_pack_string(property_name); + endfunction: do_pack$0 + +snippet uvm_sequence_item_do_unpack + function void ${1:my_class}${2:::}do_unpack(uvm_packer packer); + /* chain the unpack with parent classes */ + super.do_unpack(packer); + + /* list of local properties to be unpacked: */ + // note: look up the appropriate macro(s) for your properties! + // \`uvm_unpack_int(property_name); + // \`uvm_unpack_queue(property_name); + // \`uvm_unpack_string(property_name); + endfunction: do_unpack$0 + From 9bd88e07865bd4fa982d46356c227b07de66412a Mon Sep 17 00:00:00 2001 From: jack Date: Wed, 24 Jan 2024 11:07:23 +0800 Subject: [PATCH 46/51] Update ruby.snippets: add binding.irb debug --- snippets/ruby.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index da82185a3..8aadb71dc 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -612,6 +612,8 @@ snippet debug18 require 'ruby-debug'; debugger snippet pry require 'pry'; binding.pry +snippet irb + binding.irb snippet strf strftime('${1:%Y-%m-%d %H:%M:%S %z}')${0} # From 132717f9146d53d0aeb59a8b7272791ea0b47ff0 Mon Sep 17 00:00:00 2001 From: Alexey Vyskubov Date: Fri, 23 Feb 2024 12:32:12 +0200 Subject: [PATCH 47/51] Start Gleam snippets with tab character All other snippet files are doing this, and if it is not done at least UltiSnips complains about malformed snippet lines. --- snippets/gleam.snippets | 90 ++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/snippets/gleam.snippets b/snippets/gleam.snippets index a01e54075..bb5007512 100644 --- a/snippets/gleam.snippets +++ b/snippets/gleam.snippets @@ -1,98 +1,98 @@ snippet fn "fn" - fn ${1:function_name}(${2}) -> ${3:Nil} { - ${0:${VISUAL:todo}} - } + fn ${1:function_name}(${2}) -> ${3:Nil} { + ${0:${VISUAL:todo}} + } snippet pfn "pub fn" - pub fn ${1:function_name}(${2}) -> ${3:Nil} { - ${0:${VISUAL:todo}} - } + pub fn ${1:function_name}(${2}) -> ${3:Nil} { + ${0:${VISUAL:todo}} + } snippet test "test fn" - pub fn ${1:name}_test() { - ${0} - } + pub fn ${1:name}_test() { + ${0} + } snippet af "anonymous fn" - fn(${1}) { ${0:${VISUAL}} } + fn(${1}) { ${0:${VISUAL}} } snippet let "let binding" - let ${1} = ${0} + let ${1} = ${0} snippet l "let binding" - let ${1} = ${0} + let ${1} = ${0} snippet as "assert binding" - assert ${1} = ${0} + assert ${1} = ${0} snippet tr "try binding" - try ${1} = ${0} + try ${1} = ${0} snippet - "->" - -> ${0} + -> ${0} snippet case "case expression" - case ${1} { - ${2} -> ${0} - } + case ${1} { + ${2} -> ${0} + } snippet ty "type" - type ${1:Name} { - ${0:$1} - } + type ${1:Name} { + ${0:$1} + } snippet pty "pub type" - pub type ${1:Name} { - ${0:$1} - } + pub type ${1:Name} { + ${0:$1} + } snippet tya "type alias" - type ${1:Name} = - ${0:$1} + type ${1:Name} = + ${0:$1} snippet ptya "pub type alias" - pub type ${1:Name} = - ${0:$1} + pub type ${1:Name} = + ${0:$1} snippet ext "external type" - external type ${0} + external type ${0} snippet pext "pub external type" - pub external type ${0} + pub external type ${0} snippet exfn "external fn" - external fn ${1:function_name}(${2}) -> ${3} - = "${4}" "${0}" + external fn ${1:function_name}(${2}) -> ${3} + = "${4}" "${0}" snippet pexfn "pub external fn" - pub external fn ${1:function_name}(${2}) -> ${3} - = "${4}" "${0}" + pub external fn ${1:function_name}(${2}) -> ${3} + = "${4}" "${0}" snippet im "import" - import ${0:gleam/result} + import ${0:gleam/result} snippet im. "import exposing" - import ${1:gleam/result}.{${0}} + import ${1:gleam/result}.{${0}} snippet p "|>" - |> ${0} + |> ${0} snippet tup "tuple()" - tuple(${0:${VISUAL}}) + tuple(${0:${VISUAL}}) snippet bl "block" - { - ${0:${VISUAL}} - } + { + ${0:${VISUAL}} + } snippet tf "fn(Type) -> Type" - fn(${1}) -> ${0} + fn(${1}) -> ${0} snippet seq "should.equal" - should.equal(${0:${VISUAL}}) + should.equal(${0:${VISUAL}}) snippet strue "should.be_true" - should.be_true(${0:${VISUAL}}) + should.be_true(${0:${VISUAL}}) snippet sfalse "should.be_false" - should.be_true(${0:${VISUAL}}) + should.be_true(${0:${VISUAL}}) From 393d980157b8149b3ff65a48bc4aae24dca9c846 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Sat, 24 Feb 2024 16:09:27 +0000 Subject: [PATCH 48/51] Update Gleam for current Gleam --- snippets/gleam.snippets | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/snippets/gleam.snippets b/snippets/gleam.snippets index bb5007512..de4056976 100644 --- a/snippets/gleam.snippets +++ b/snippets/gleam.snippets @@ -23,10 +23,7 @@ snippet l "let binding" let ${1} = ${0} snippet as "assert binding" - assert ${1} = ${0} - -snippet tr "try binding" - try ${1} = ${0} + let assert ${1} = ${0} snippet - "->" -> ${0} @@ -54,20 +51,6 @@ snippet ptya "pub type alias" pub type ${1:Name} = ${0:$1} -snippet ext "external type" - external type ${0} - -snippet pext "pub external type" - pub external type ${0} - -snippet exfn "external fn" - external fn ${1:function_name}(${2}) -> ${3} - = "${4}" "${0}" - -snippet pexfn "pub external fn" - pub external fn ${1:function_name}(${2}) -> ${3} - = "${4}" "${0}" - snippet im "import" import ${0:gleam/result} @@ -77,9 +60,6 @@ snippet im. "import exposing" snippet p "|>" |> ${0} -snippet tup "tuple()" - tuple(${0:${VISUAL}}) - snippet bl "block" { ${0:${VISUAL}} @@ -95,4 +75,4 @@ snippet strue "should.be_true" should.be_true(${0:${VISUAL}}) snippet sfalse "should.be_false" - should.be_true(${0:${VISUAL}}) + should.be_false(${0:${VISUAL}}) From a1f605c302c6a6b2346de5eca245c0406fef13ba Mon Sep 17 00:00:00 2001 From: Andrei Eremeev Date: Tue, 28 May 2024 11:25:53 +0200 Subject: [PATCH 49/51] fix: go: st and inf generated non-compilable code --- snippets/go.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/go.snippets b/snippets/go.snippets index 7245252c6..1c785f862 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -59,7 +59,7 @@ snippet in "interface" interface{} snippet inf "full interface " - interface ${1:name} { + type ${1:name} interface { ${2:/* methods */} } @@ -188,7 +188,7 @@ snippet sr "string" string snippet st "struct" - struct ${1:name} { + type ${1:name} struct { ${2:/* data */} } ${0} From 96d79529edc3dee1ccf2ce7b75a88cb546ec2501 Mon Sep 17 00:00:00 2001 From: Yinzuo Jiang Date: Mon, 10 Jun 2024 22:10:07 +0800 Subject: [PATCH 50/51] Update gitcommit.snippets: add Co-authored-by snippet --- UltiSnips/gitcommit.snippets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/UltiSnips/gitcommit.snippets b/UltiSnips/gitcommit.snippets index e2f1ba5d0..353aff747 100644 --- a/UltiSnips/gitcommit.snippets +++ b/UltiSnips/gitcommit.snippets @@ -71,6 +71,10 @@ build(${1:scope}): ${2:title} ${0:${VISUAL}} endsnippet +snippet Co-authored-by "Co-authored-by:" +Co-authored-by: ${1:Author Name} <${2:Email}> +endsnippet + snippet sign "Signature" ------------------------------------------------------------------------------- ${1:Company Name} From f0a3184d9f90b96b044d5914625a25c554d7f301 Mon Sep 17 00:00:00 2001 From: Joshua Petitma Date: Fri, 9 Aug 2024 09:55:50 -0700 Subject: [PATCH 51/51] Update markdown.snippets Don't add a default protocol --- snippets/markdown.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/markdown.snippets b/snippets/markdown.snippets index 39ccecd76..a8b00cfb2 100644 --- a/snippets/markdown.snippets +++ b/snippets/markdown.snippets @@ -5,7 +5,7 @@ # The suffix `c` stands for "Clipboard". snippet [ - [${1:text}](https://${2:address}) + [${1:text}](${2:address}) snippet [* [${1:link}](${2:`@*`}) snippet [c