diff options
author | Jesse Luehrs <doy@tozt.net> | 2017-10-20 00:53:39 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2017-10-20 03:50:24 -0400 |
commit | 41413ffceab7fc9969c4d1fa77e2f44ac5b86a76 (patch) | |
tree | db5df27317b101a251b5d2c5fcb22850a9d03ee4 /vim/snippets/perl.snippets | |
parent | 12148e261d83b96c25f440ea41c7633ca281b7b2 (diff) | |
download | conf-41413ffceab7fc9969c4d1fa77e2f44ac5b86a76.tar.gz conf-41413ffceab7fc9969c4d1fa77e2f44ac5b86a76.zip |
clean up snippets a bit
Diffstat (limited to 'vim/snippets/perl.snippets')
-rw-r--r-- | vim/snippets/perl.snippets | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/vim/snippets/perl.snippets b/vim/snippets/perl.snippets index 76e7820..d522f63 100644 --- a/vim/snippets/perl.snippets +++ b/vim/snippets/perl.snippets @@ -1,48 +1,41 @@ -snippet try - try { - ${1} - } catch { - ${2} - }; -snippet st - map { $_->[0] } - sort { $a->[1] ${3:cmp} $b->[1] } - map { [$_, ${2:function}] } - ${1:list} snippet tbl local $Test::Builder::Level = $Test::Builder::Level + 1; snippet ccl local $Carp::CarpLevel = $Carp::CarpLevel + 1; snippet linc local $${1:a} = $$1 + ${2:1}; - ${3} + ${0} snippet script #!/usr/bin/env perl use strict; use warnings; - - ${1} + + ${0} snippet test #!/usr/bin/env perl use strict; use warnings; use Test::More; - ${1} + ${0} done_testing; -snippet nac - use namespace::autoclean; +snippet sub + sub ${1:foo} { + ${0} + } snippet wd use Data::Dump; ddx(${1}); + ${0} snippet wdd use Data::Dump; push @Data::Dump::FILTERS, sub { return {dump => "$_[1]"} if $_[0]->depth > ${1:1} }; ddx(${2}); + ${0} snippet package package ${1:`substitute(matchstr(expand("%"), '^lib/\zs.*\ze\.pm'), '/', '::', 'g')`}; use strict; use warnings; - ${2} + ${0} 1; snippet test_psgi @@ -52,7 +45,7 @@ snippet test_psgi my $cb = shift; { - ${2} + ${0} } }; # @@ -62,7 +55,7 @@ snippet class package ${1:`substitute(matchstr(expand("%"), '^lib/\zs.*\ze\.pm'), '/', '::', 'g')`}; use Moose; - ${2} + ${0} __PACKAGE__->meta->make_immutable; no Moose; @@ -76,7 +69,7 @@ snippet subclass use Moose; extends '${2:`matchstr(substitute(matchstr(expand("%"), '^lib/\zs.*\ze\.pm'), '/', '::', 'g'), '.*\ze::.*')`}'; - ${3} + ${0} __PACKAGE__->meta->make_immutable; no Moose; @@ -86,7 +79,7 @@ snippet role package ${1:`substitute(matchstr(expand("%"), '^lib/\zs.*\ze\.pm'), '/', '::', 'g')`}; use Moose::Role; - ${2} + ${0} no Moose::Role; @@ -94,7 +87,7 @@ snippet role snippet has has ${1:attr} => ( is => '${2:ro}', - isa => '${3:Str}',${4} + isa => '${3:Str}',${0} ); snippet hasl has ${1:attr} => ( @@ -105,26 +98,26 @@ snippet hasl sub _build_$1 { my $self = shift; - ${5} + ${0} } snippet m sub ${1:foo} { my $self = shift; - ${2} + ${0} } snippet around around ${1:foo} => sub { my $orig = shift; my $self = shift; - ${2} + ${0} }; snippet after after ${1:foo} => sub { my $self = shift; - ${2} + ${0} }; snippet before before ${1:foo} => sub { my $self = shift; - ${2} + ${0} }; |