diff options
-rw-r--r-- | .vim/UltiSnips/perl.snippets | 150 | ||||
-rw-r--r-- | .vim/UltiSnips/tex.snippets | 11 |
2 files changed, 161 insertions, 0 deletions
diff --git a/.vim/UltiSnips/perl.snippets b/.vim/UltiSnips/perl.snippets index 61d9a83..51589b5 100644 --- a/.vim/UltiSnips/perl.snippets +++ b/.vim/UltiSnips/perl.snippets @@ -12,3 +12,153 @@ method new_no_defaults($class: $deps = {}) { } endsnippet + +snippet mpod +=head3 ${1:method name} + + my ${4:x} = $${2:class}->$1(${3:params}); + +$0 + +=cut +endsnippet + +snippet method +=head3 ${1:method name} + + my ${4:x} = $${2:class}->$1(${3:params}); + +$5 + +=cut + +method $1($3) { + $0 +} +endsnippet + +snippet pname +${1:`!v expand('%:p:s?.*lib/??:r:gs?/?::?')`} +endsnippet + +snippet package +package ${1:`!v expand('%:p:s?.*lib/??:r:gs?/?::?')`}; +use strictures; + +use autodie; +use Function::Parameters; +use Log::Any qw($log); + +=head1 NAME + +$1 - ${2:ShortDesc} + +=head1 SYNOPSIS + +use $1; + +${3:# synopsis...} + +=head1 DESCRIPTION + +${4:# longer description...} + +=head1 METHODS + +=head2 new + + my $${5:obj} = $1->new(); + +Returns a new instance. + +=cut + +method new($class: $deps = {}) { + return $class->new_no_defaults($deps); +} + +method new_no_defaults($class: $deps = {}) { + my $self = {}; + bless $self, $class; + $self->{deps} = $deps; + return $self; +} + +=head2 Public Methods + +=cut + +$0 + +1; + +__END__ +endsnippet + +snippet packagectx +package ${1:`!v expand('%:p:s?.*lib/??:r:gs?/?::?')`}; +use strictures; + +use autodie; +use Function::Parameters; +use Log::Any qw($log); + +=head1 NAME + +$1 - ${2:ShortDesc} + +=head1 SYNOPSIS + +use $1; + +${3:# synopsis...} + +=head1 DESCRIPTION + +${4:# longer description...} + +=head1 METHODS + +=head2 new + + my $${5:obj} = $1->new(); + +Returns a new instance or an existing instance for singleton classes. + +=cut + +method new($class: $context, $deps = {}) { + return $class->new_no_defaults($context, $deps); +} + +method new_no_defaults($class: $context, $deps = {}) { + return $context->{$class} if defined $context->{$class}; + + my $self = {}; + bless $self, $class; + $self->{deps} = $deps; + $context->{$class} = $self; + return $self; +} + +=head2 Public Methods + +=cut + +$0 + +1; + +__END__ +endsnippet + +snippet testf +use strictures 2; + +use Log::Any::Adapter ('TAP'); +use Test::More; +use Test::MockObject; +use Test::Differences; +use Test::Exception; + +endsnippet diff --git a/.vim/UltiSnips/tex.snippets b/.vim/UltiSnips/tex.snippets index 1c29c16..a021cc4 100644 --- a/.vim/UltiSnips/tex.snippets +++ b/.vim/UltiSnips/tex.snippets @@ -10,3 +10,14 @@ snippet frame "frame environment" b \end{frame} endsnippet +snippet lst "lstlisting" b +\begin{lstlisting}[caption={$1},label=lst:$2] +$0 +\end{lstlisting} +endsnippet + +snippet minipage "minipage" b +\begin{minipage}{\textwidth} +$0 +\end{minipage} +endsnippet |