1
0
mirror of https://github.com/gryf/snipmate.vim.git synced 2025-12-19 12:28:11 +01:00

changed perl snippets to match perl preferred practises (issue#72)

This commit is contained in:
msanders
2009-12-28 03:14:22 -05:00
parent 1b261234b2
commit 9fe9170564

View File

@@ -1,7 +1,7 @@
# #!/usr/bin/env perl
# #!/usr/bin/perl
snippet #!
#!/usr/bin/env perl
#!/usr/bin/perl
# Hash Pointer
snippet .
=>
@@ -19,16 +19,19 @@ snippet if
snippet ife
if (${1}) {
${2:# body...}
} else {
}
else {
${3:# else...}
}
# Conditional if..elsif..else
snippet ifee
if (${1}) {
${2:# body...}
} elsif (${3}) {
}
elsif (${3}) {
${4:# elsif...}
} else {
}
else {
${5:# else...}
}
# Conditional One-line
@@ -58,32 +61,35 @@ snippet wh
# While Loop One-line
snippet xwh
${1:expression} while ${2:condition};${3}
# For Loop
snippet for
# C-style For Loop
snippet cfor
for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) {
${4:# body...}
}
# For loop one-line
snippet xfor
${1:expression} for @${2:array};${3}
# Foreach Loop
snippet fore
snippet for
foreach my $${1:x} (@${2:array}) {
${3:# body...}
}
# Foreach Loop One-line
snippet xfore
snippet fore
${1:expression} foreach @${2:array};${3}
# Package
snippet cl
package ${1:ClassName};
use base qw(${2:ParentClass});
sub new {
my $class = shift;
$class = ref $class if ref $class;
my $self = bless {}, $class;
$self;
}
1;${3}
# Read File
snippet slurp