aboutsummaryrefslogtreecommitdiff
path: root/vim/bundle/vim-snippets/UltiSnips/perl.snippets
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2016-06-30 16:03:25 +0200
committerKarel Kočí <cynerd@email.cz>2016-06-30 16:03:25 +0200
commite573b3020c032400eed60b649a2cbf55266e6bb0 (patch)
tree8f572394ac8433529c7a8e70d160a2fbe8268b4e /vim/bundle/vim-snippets/UltiSnips/perl.snippets
parentb8c667bd64b3edd38d56c63c5bd1db53a23b4499 (diff)
downloadmyconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.tar.gz
myconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.tar.bz2
myconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.zip
Add current configurations from old repository
Diffstat (limited to 'vim/bundle/vim-snippets/UltiSnips/perl.snippets')
-rw-r--r--vim/bundle/vim-snippets/UltiSnips/perl.snippets139
1 files changed, 139 insertions, 0 deletions
diff --git a/vim/bundle/vim-snippets/UltiSnips/perl.snippets b/vim/bundle/vim-snippets/UltiSnips/perl.snippets
new file mode 100644
index 0000000..67c7f27
--- /dev/null
+++ b/vim/bundle/vim-snippets/UltiSnips/perl.snippets
@@ -0,0 +1,139 @@
+priority -50
+
+###########################################################################
+# TextMate Snippets #
+###########################################################################
+snippet ife "Conditional if..else (ife)"
+if ($1) {
+ ${2:# body...}
+}
+else {
+ ${3:# else...}
+}
+
+endsnippet
+
+snippet ifee "Conditional if..elsif..else (ifee)"
+if ($1) {
+ ${2:# body...}
+}
+elsif ($3) {
+ ${4:# elsif...}
+}
+else {
+ ${5:# else...}
+}
+
+endsnippet
+
+snippet xunless "Conditional one-line (unless)"
+${1:expression} unless ${2:condition};
+
+endsnippet
+
+snippet xif "Conditional one-line (xif)"
+${1:expression} if ${2:condition};
+
+endsnippet
+
+snippet sub "Function (sub)"
+sub ${1:function_name} {
+ ${2:# body...}
+}
+
+endsnippet
+
+snippet xfore "Loop one-line (xforeach)"
+${1:expression} foreach @${2:array};
+
+endsnippet
+
+snippet xwhile "Loop one-line (xwhile)"
+${1:expression} while ${2:condition};
+
+endsnippet
+
+snippet test "Test"
+#!/usr/bin/env perl -w
+
+use strict;
+use Test::More tests => ${1:1};
+use ${2:ModuleName};
+
+ok(${3:assertion});
+
+endsnippet
+
+snippet class "class"
+package ${1:ClassName};
+
+${2:use parent qw(${3:ParentClass});}${2/.+/\n\n/}sub new {
+ my $class = shift;
+ $class = ref $class if ref $class;
+ my $self = bless {}, $class;
+ $self;
+}
+
+1;
+
+endsnippet
+
+snippet eval "eval"
+local $@;
+eval {
+ ${1:# do something risky...}
+};
+if (my $${2:exception} = $@) {
+ ${3:# handle failure...}
+}
+
+endsnippet
+
+snippet for "for"
+for (my $${1:var} = 0; $$1 < ${2:expression}; $$1++) {
+ ${3:# body...}
+}
+
+endsnippet
+
+snippet fore "foreach"
+foreach ${1:my $${2:x}} (@${3:array}) {
+ ${4:# body...}
+}
+
+endsnippet
+
+snippet if "if"
+if ($1) {
+ ${2:# body...}
+}
+
+endsnippet
+
+snippet slurp "slurp"
+my $${1:var} = do { local $/ = undef; open my $fh, '<', ${2:$file}; <$fh> };
+
+endsnippet
+
+snippet unless "unless"
+unless ($1) {
+ ${2:# body...}
+}
+
+endsnippet
+
+snippet while "while"
+while ($1) {
+ ${2:# body...}
+}
+
+endsnippet
+
+snippet until "until"
+until ($1) {
+ ${2:# body...}
+}
+
+endsnippet
+
+# vim:ft=snippets: