mirror of
https://github.com/joaotavora/yasnippet.git
synced 2026-05-05 15:28:18 +00:00
add more snippets
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
#name : eval { ... } if ($@) { ... }
|
||||||
|
# --
|
||||||
|
eval {
|
||||||
|
${1:# do something risky...}
|
||||||
|
};
|
||||||
|
if (\$@) {
|
||||||
|
${2:# handle failure...}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#name : for (...) { ... }
|
||||||
|
# --
|
||||||
|
for (my \$${1:var} = 0; \$$1 < ${2:expression}; \$$1++) {
|
||||||
|
${3:# body...}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#name : foreach ... { ... }
|
||||||
|
# --
|
||||||
|
foreach my \$${1:x} (@${2:array}) {
|
||||||
|
${3:# body...}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#name : if (...) { ... }
|
||||||
|
# --
|
||||||
|
if ($1) {
|
||||||
|
$0
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#name : if (...) { ... } else { ... }
|
||||||
|
# --
|
||||||
|
if ($1) {
|
||||||
|
$2
|
||||||
|
} else {
|
||||||
|
$3
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#name : if, elsif, else ...
|
||||||
|
# --
|
||||||
|
if ($1) {
|
||||||
|
${2:# body...}
|
||||||
|
} elsif ($3) {
|
||||||
|
${4:# elsif...}
|
||||||
|
} else {
|
||||||
|
${5:# else...}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#name : sub ... { ... }
|
||||||
|
# --
|
||||||
|
sub ${1:function_name} {
|
||||||
|
$0
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#name : unless (...) { ... }
|
||||||
|
# --
|
||||||
|
unless ($1) {
|
||||||
|
$0
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#name : while (...) { ... }
|
||||||
|
# --
|
||||||
|
while ($1) {
|
||||||
|
$0
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : ... foreach ...
|
||||||
|
# --
|
||||||
|
${1:expression} foreach @${2:array};
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : ... if ...
|
||||||
|
# --
|
||||||
|
${1:expression} if ${2:condition}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : ... unless ...
|
||||||
|
# --
|
||||||
|
${1:expression} unless ${2:condition}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : ... while ...
|
||||||
|
# --
|
||||||
|
${1:expression} while ${2:condition};
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : __...__
|
||||||
|
# --
|
||||||
|
__${init}__
|
||||||
Reference in New Issue
Block a user