From f5b8c378e729f4d8682a684ab320366a951164ad Mon Sep 17 00:00:00 2001 From: William Travis Holton Date: Wed, 16 May 2012 08:09:49 +1200 Subject: [PATCH 01/97] use parent instead of base --- snippets/perl.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index 4ba985d..0037cc3 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -82,7 +82,7 @@ snippet fore snippet cl package ${1:ClassName}; - use base qw(${2:ParentClass}); + use parent qw(${2:ParentClass}); sub new { my $class = shift; From fab29b6279ac835fe08fee4ade15bc4a8fc82fc6 Mon Sep 17 00:00:00 2001 From: William Travis Holton Date: Wed, 16 May 2012 18:21:55 +1200 Subject: [PATCH 02/97] experimenting with a couple new package constructs --- snippets/perl.snippets | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index 0037cc3..d77d748 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -82,16 +82,30 @@ snippet fore snippet cl package ${1:ClassName}; - use parent qw(${2:ParentClass}); + #use parent qw(${2:ParentClass}); - sub new { - my $class = shift; - $class = ref $class if ref $class; - my $self = bless {}, $class; - $self; - } 1;${3} + + __END__ + +# Package block syntax +snippet package + package ${1:ClassName} ${2:version} { + + ${3:#}use Moose; + + ${4:#}use parent qw(${5:ParentClass}); + ${3:#}extends qw(${5:ParentClass}); + + ${6:#...} + + } + + 1; + + __END__ + # Read File snippet slurp my $${1:var} = do { local $/; open my $file, '<', "${2:file}"; <$file> }; From 75598b4fee28a149d92f4a809a3911ececd3b441 Mon Sep 17 00:00:00 2001 From: William Travis Holton Date: Wed, 16 May 2012 20:32:53 +1200 Subject: [PATCH 03/97] experimenting with some new perl features --- snippets/perl.snippets | 86 ++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 46 deletions(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index d77d748..2796658 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -83,29 +83,51 @@ snippet cl package ${1:ClassName}; #use parent qw(${2:ParentClass}); - - - 1;${3} - - __END__ - -# Package block syntax -snippet package - package ${1:ClassName} ${2:version} { - - ${3:#}use Moose; - - ${4:#}use parent qw(${5:ParentClass}); - ${3:#}extends qw(${5:ParentClass}); - - ${6:#...} - - } + + ${3:#...} 1; __END__ +# Moose package +snippet moosecl + package ${1:ClassName}; + + use Moose; + #extends '${2:# ParentClass}'; + + ${3:#...} + + 1; + + + __END__ + + +# Package syntax perl >= 5.12.0 +snippet package + package ${1:ClassName} ${2:0.99}; + + ${3:#...} + + 1; + + __END__ + + +#moose +snippet moose + use Moose; + +# moose extends +snippet extends + extends qw(${1:Parent Class}); + +# parent +snippet parent + use parent qw(${1:Parent Class}); + # Read File snippet slurp my $${1:var} = do { local $/; open my $file, '<', "${2:file}"; <$file> }; @@ -190,7 +212,6 @@ snippet hslice @{ ${1:hash} }{ ${2:array} } - # map snippet map map { ${2: body } } ${1: @array } ; @@ -276,33 +297,6 @@ snippet parg -# Moose package -snippet moosecl - package ${1:ClassName}; - - use Moose; - #extends '${2:# ParentClass}'; - - ${6:# body of class} - - 1; - - - __END__ - - =head1 NAME - - $1 - ${3:ShortDesc} - - =head1 SYNOPSIS - - ${4:# synopsis...} - - =head1 DESCRIPTION - - ${5:# longer description...} - - # Moose has snippet has has ${1:attribute} => ( From a5362402b819b01793ae7cbc5f5f1a467657f313 Mon Sep 17 00:00:00 2001 From: William Travis Holton Date: Wed, 16 May 2012 22:05:44 +1200 Subject: [PATCH 04/97] make package definitions more generic --- snippets/perl.snippets | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index 2796658..8164130 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -82,9 +82,7 @@ snippet fore snippet cl package ${1:ClassName}; - #use parent qw(${2:ParentClass}); - - ${3:#...} + ${2:#...} 1; @@ -93,7 +91,7 @@ snippet cl # Moose package snippet moosecl package ${1:ClassName}; - + use Moose; #extends '${2:# ParentClass}'; From 02160ecee14d759297b3e4db2fdbad7a1caffd30 Mon Sep 17 00:00:00 2001 From: Stephen Tudor Date: Thu, 31 May 2012 11:23:21 -0400 Subject: [PATCH 05/97] JS whitespace style --- snippets/javascript.snippets | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/snippets/javascript.snippets b/snippets/javascript.snippets index de50a0c..1282f73 100644 --- a/snippets/javascript.snippets +++ b/snippets/javascript.snippets @@ -11,12 +11,12 @@ snippet fun } # Anonymous Function snippet f - function(${1}) { + function (${1}) { ${3} }${2:;} # Immediate function snippet (f - (function(${1}) { + (function (${1}) { ${3:/* code */} }(${2})); # if @@ -36,7 +36,7 @@ snippet t ${1:/* condition */} ? ${2:a} : ${3:b} # switch snippet switch - switch(${1:expression}) { + switch (${1:expression}) { case '${3:case}': ${4:// code} break; @@ -69,7 +69,7 @@ snippet wh snippet try try { ${1:/* code */} - } catch(${2:e}) { + } catch (${2:e}) { ${3:/* handle error */} } # do...while @@ -79,12 +79,12 @@ snippet do } while (${1:/* condition */}); # Object Method snippet :f - ${1:method_name}: function(${2:attribute}) { + ${1:method_name}: function (${2:attribute}) { ${4} }${3:,} # setTimeout function snippet timeout - setTimeout(function() {${3}}${2}, ${1:10}); + setTimeout(function () {${3}}${2}, ${1:10}); # Get Elements snippet get getElementsBy${1:TagName}('${2}')${3} From dac0f8a7a68fc68e622acc965722e564a6bfc515 Mon Sep 17 00:00:00 2001 From: William Travis Holton Date: Wed, 25 Jul 2012 22:27:09 +1200 Subject: [PATCH 06/97] changing package template and a few others --- snippets/perl.snippets | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index 8164130..ef30667 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -79,7 +79,7 @@ snippet for snippet fore ${1:expression} foreach @${2:array};${3} # Package -snippet cl +snippet package package ${1:ClassName}; ${2:#...} @@ -88,23 +88,9 @@ snippet cl __END__ -# Moose package -snippet moosecl - package ${1:ClassName}; - - use Moose; - #extends '${2:# ParentClass}'; - - ${3:#...} - - 1; - - - __END__ - # Package syntax perl >= 5.12.0 -snippet package +snippet packagev512 package ${1:ClassName} ${2:0.99}; ${3:#...} @@ -117,6 +103,8 @@ snippet package #moose snippet moose use Moose; + use namespace::autoclean; + #extends '${2:# ParentClass}'; # moose extends snippet extends @@ -298,10 +286,12 @@ snippet parg # Moose has snippet has has ${1:attribute} => ( - is => '${2:ro|rw}', + is => '${2:ro|rw}', isa => '${3:Str|Int|HashRef|ArrayRef|etc}', - default => ${4:defaultvalue} - ,${5:# other attributes} + default => sub { + ${4:defaultvalue} + }, + ${5:# other attributes} ); @@ -309,14 +299,14 @@ snippet has snippet override override ${1:attribute} => sub { ${2:# my $self = shift;}; - ${3:# my ($self,$args) = @_;}; + ${3:# my ($self, $args) = @_;}; }; # use test classes snippet tuse use Test::More; - use Test::Deep (); + use Test::Deep; # (); # uncomment to stop prototype errors use Test::Exception; # local test lib @@ -353,6 +343,7 @@ snippet tprep my $self = shift; ${4:# body} } + # cause failures to print stack trace snippet debug_trace use Carp; # 'verbose'; From cdacf7c3df67163b4bf9ce8ca863af84c1d72ee9 Mon Sep 17 00:00:00 2001 From: William Travis Holton Date: Wed, 25 Jul 2012 22:37:23 +1200 Subject: [PATCH 07/97] experimenting with file name in package snippet --- snippets/perl.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index ef30667..9afdee6 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -91,7 +91,7 @@ snippet package # Package syntax perl >= 5.12.0 snippet packagev512 - package ${1:ClassName} ${2:0.99}; + package ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} ${2:0.99}; ${3:#...} @@ -104,7 +104,7 @@ snippet packagev512 snippet moose use Moose; use namespace::autoclean; - #extends '${2:# ParentClass}'; + ${1:#}extends '${2:# ParentClass}'; # moose extends snippet extends From f46672c1cf2e71f570ee6fec770a211b8e451daa Mon Sep 17 00:00:00 2001 From: William Travis Holton Date: Wed, 25 Jul 2012 22:43:24 +1200 Subject: [PATCH 08/97] substitute regular package name --- snippets/perl.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index 9afdee6..79462fc 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -80,7 +80,7 @@ snippet fore ${1:expression} foreach @${2:array};${3} # Package snippet package - package ${1:ClassName}; + package ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}; ${2:#...} @@ -104,7 +104,7 @@ snippet packagev512 snippet moose use Moose; use namespace::autoclean; - ${1:#}extends '${2:# ParentClass}'; + ${1:#}extends '${2:ParentClass}'; # moose extends snippet extends From c59a7f2c49bcf0b7eb91498cb4184b09818a9149 Mon Sep 17 00:00:00 2001 From: William Travis Holton Date: Wed, 16 May 2012 08:09:49 +1200 Subject: [PATCH 09/97] use parent instead of base --- snippets/perl.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index 4ba985d..0037cc3 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -82,7 +82,7 @@ snippet fore snippet cl package ${1:ClassName}; - use base qw(${2:ParentClass}); + use parent qw(${2:ParentClass}); sub new { my $class = shift; From 79b4377ee3caf2060b4ffdcc3ccf39fbcdde5ded Mon Sep 17 00:00:00 2001 From: William Travis Holton Date: Wed, 16 May 2012 18:21:55 +1200 Subject: [PATCH 10/97] experimenting with a couple new package constructs --- snippets/perl.snippets | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index 0037cc3..d77d748 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -82,16 +82,30 @@ snippet fore snippet cl package ${1:ClassName}; - use parent qw(${2:ParentClass}); + #use parent qw(${2:ParentClass}); - sub new { - my $class = shift; - $class = ref $class if ref $class; - my $self = bless {}, $class; - $self; - } 1;${3} + + __END__ + +# Package block syntax +snippet package + package ${1:ClassName} ${2:version} { + + ${3:#}use Moose; + + ${4:#}use parent qw(${5:ParentClass}); + ${3:#}extends qw(${5:ParentClass}); + + ${6:#...} + + } + + 1; + + __END__ + # Read File snippet slurp my $${1:var} = do { local $/; open my $file, '<', "${2:file}"; <$file> }; From b272f87f1f05ed81e57fc4356507a38892b5f8b8 Mon Sep 17 00:00:00 2001 From: William Travis Holton Date: Wed, 16 May 2012 20:32:53 +1200 Subject: [PATCH 11/97] experimenting with some new perl features --- snippets/perl.snippets | 86 ++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 46 deletions(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index d77d748..2796658 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -83,29 +83,51 @@ snippet cl package ${1:ClassName}; #use parent qw(${2:ParentClass}); - - - 1;${3} - - __END__ - -# Package block syntax -snippet package - package ${1:ClassName} ${2:version} { - - ${3:#}use Moose; - - ${4:#}use parent qw(${5:ParentClass}); - ${3:#}extends qw(${5:ParentClass}); - - ${6:#...} - - } + + ${3:#...} 1; __END__ +# Moose package +snippet moosecl + package ${1:ClassName}; + + use Moose; + #extends '${2:# ParentClass}'; + + ${3:#...} + + 1; + + + __END__ + + +# Package syntax perl >= 5.12.0 +snippet package + package ${1:ClassName} ${2:0.99}; + + ${3:#...} + + 1; + + __END__ + + +#moose +snippet moose + use Moose; + +# moose extends +snippet extends + extends qw(${1:Parent Class}); + +# parent +snippet parent + use parent qw(${1:Parent Class}); + # Read File snippet slurp my $${1:var} = do { local $/; open my $file, '<', "${2:file}"; <$file> }; @@ -190,7 +212,6 @@ snippet hslice @{ ${1:hash} }{ ${2:array} } - # map snippet map map { ${2: body } } ${1: @array } ; @@ -276,33 +297,6 @@ snippet parg -# Moose package -snippet moosecl - package ${1:ClassName}; - - use Moose; - #extends '${2:# ParentClass}'; - - ${6:# body of class} - - 1; - - - __END__ - - =head1 NAME - - $1 - ${3:ShortDesc} - - =head1 SYNOPSIS - - ${4:# synopsis...} - - =head1 DESCRIPTION - - ${5:# longer description...} - - # Moose has snippet has has ${1:attribute} => ( From 313ec98d836305ae913344a4ba71a8926e3440f3 Mon Sep 17 00:00:00 2001 From: William Travis Holton Date: Wed, 16 May 2012 22:05:44 +1200 Subject: [PATCH 12/97] make package definitions more generic --- snippets/perl.snippets | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index 2796658..8164130 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -82,9 +82,7 @@ snippet fore snippet cl package ${1:ClassName}; - #use parent qw(${2:ParentClass}); - - ${3:#...} + ${2:#...} 1; @@ -93,7 +91,7 @@ snippet cl # Moose package snippet moosecl package ${1:ClassName}; - + use Moose; #extends '${2:# ParentClass}'; From af4851445519c4ee7df3c1f31f1d000e22e0ef88 Mon Sep 17 00:00:00 2001 From: William Travis Holton Date: Wed, 25 Jul 2012 22:27:09 +1200 Subject: [PATCH 13/97] changing package template and a few others --- snippets/perl.snippets | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index 8164130..ef30667 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -79,7 +79,7 @@ snippet for snippet fore ${1:expression} foreach @${2:array};${3} # Package -snippet cl +snippet package package ${1:ClassName}; ${2:#...} @@ -88,23 +88,9 @@ snippet cl __END__ -# Moose package -snippet moosecl - package ${1:ClassName}; - - use Moose; - #extends '${2:# ParentClass}'; - - ${3:#...} - - 1; - - - __END__ - # Package syntax perl >= 5.12.0 -snippet package +snippet packagev512 package ${1:ClassName} ${2:0.99}; ${3:#...} @@ -117,6 +103,8 @@ snippet package #moose snippet moose use Moose; + use namespace::autoclean; + #extends '${2:# ParentClass}'; # moose extends snippet extends @@ -298,10 +286,12 @@ snippet parg # Moose has snippet has has ${1:attribute} => ( - is => '${2:ro|rw}', + is => '${2:ro|rw}', isa => '${3:Str|Int|HashRef|ArrayRef|etc}', - default => ${4:defaultvalue} - ,${5:# other attributes} + default => sub { + ${4:defaultvalue} + }, + ${5:# other attributes} ); @@ -309,14 +299,14 @@ snippet has snippet override override ${1:attribute} => sub { ${2:# my $self = shift;}; - ${3:# my ($self,$args) = @_;}; + ${3:# my ($self, $args) = @_;}; }; # use test classes snippet tuse use Test::More; - use Test::Deep (); + use Test::Deep; # (); # uncomment to stop prototype errors use Test::Exception; # local test lib @@ -353,6 +343,7 @@ snippet tprep my $self = shift; ${4:# body} } + # cause failures to print stack trace snippet debug_trace use Carp; # 'verbose'; From 2abf84e6b90d9fb2c38929048bff2da1cb968b40 Mon Sep 17 00:00:00 2001 From: William Travis Holton Date: Wed, 25 Jul 2012 22:37:23 +1200 Subject: [PATCH 14/97] experimenting with file name in package snippet --- snippets/perl.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index ef30667..9afdee6 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -91,7 +91,7 @@ snippet package # Package syntax perl >= 5.12.0 snippet packagev512 - package ${1:ClassName} ${2:0.99}; + package ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} ${2:0.99}; ${3:#...} @@ -104,7 +104,7 @@ snippet packagev512 snippet moose use Moose; use namespace::autoclean; - #extends '${2:# ParentClass}'; + ${1:#}extends '${2:# ParentClass}'; # moose extends snippet extends From a42eb6a320285a522847b04e678804850beb6c48 Mon Sep 17 00:00:00 2001 From: William Travis Holton Date: Wed, 25 Jul 2012 22:43:24 +1200 Subject: [PATCH 15/97] substitute regular package name --- snippets/perl.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index 9afdee6..79462fc 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -80,7 +80,7 @@ snippet fore ${1:expression} foreach @${2:array};${3} # Package snippet package - package ${1:ClassName}; + package ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}; ${2:#...} @@ -104,7 +104,7 @@ snippet packagev512 snippet moose use Moose; use namespace::autoclean; - ${1:#}extends '${2:# ParentClass}'; + ${1:#}extends '${2:ParentClass}'; # moose extends snippet extends From 2f701a905899aac4b364943d0803ddee84b955e2 Mon Sep 17 00:00:00 2001 From: Travis Holton Date: Thu, 26 Jul 2012 09:57:26 +1200 Subject: [PATCH 16/97] put extends in a BEGIN block --- snippets/perl.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index 79462fc..dbe9288 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -104,7 +104,7 @@ snippet packagev512 snippet moose use Moose; use namespace::autoclean; - ${1:#}extends '${2:ParentClass}'; + ${1:#}BEGIN {extends '${2:ParentClass}}'; # moose extends snippet extends From 0d5ecadc576ad095bcdf33c010340ac1e79d1040 Mon Sep 17 00:00:00 2001 From: Travis Holton Date: Thu, 26 Jul 2012 16:07:33 +1200 Subject: [PATCH 17/97] fix quote on moose snippet --- snippets/perl.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index dbe9288..024aee1 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -104,7 +104,7 @@ snippet packagev512 snippet moose use Moose; use namespace::autoclean; - ${1:#}BEGIN {extends '${2:ParentClass}}'; + ${1:#}BEGIN {extends '${2:ParentClass}'}; # moose extends snippet extends From c805b4f24131b05ee85e2a77187a444a260f9639 Mon Sep 17 00:00:00 2001 From: Travis Holton Date: Thu, 26 Jul 2012 16:08:11 +1200 Subject: [PATCH 18/97] put in a goto point to jump to --- snippets/perl.snippets | 1 + 1 file changed, 1 insertion(+) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index 024aee1..6416180 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -105,6 +105,7 @@ snippet moose use Moose; use namespace::autoclean; ${1:#}BEGIN {extends '${2:ParentClass}'}; + ${3} # moose extends snippet extends From 4987a54300a90f9d2e35e32a31846bf6f74c1887 Mon Sep 17 00:00:00 2001 From: William Travis Holton Date: Thu, 26 Jul 2012 21:35:03 +1200 Subject: [PATCH 19/97] took some whitespace out removed some redundant snippets --- snippets/perl.snippets | 52 ++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 35 deletions(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index 6416180..e8de8fb 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -82,68 +82,51 @@ snippet fore snippet package package ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}; - ${2:#...} + ${2} 1; __END__ - - -# Package syntax perl >= 5.12.0 -snippet packagev512 +# Package syntax perl >= 5.14 +snippet packagev514 package ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} ${2:0.99}; - ${3:#...} + ${3} 1; __END__ - - #moose snippet moose use Moose; use namespace::autoclean; ${1:#}BEGIN {extends '${2:ParentClass}'}; + ${3} - -# moose extends -snippet extends - extends qw(${1:Parent Class}); - # parent snippet parent use parent qw(${1:Parent Class}); - # Read File snippet slurp my $${1:var} = do { local $/; open my $file, '<', "${2:file}"; <$file> }; ${3} - - # strict warnings snippet strwar use strict; use warnings; - - -# standard versioning with perlcritic bypass +# older versioning with perlcritic bypass snippet vers ## no critic our $VERSION = '${1:version}'; eval $VERSION; ## use critic - - # new 'switch' like feature snippet switch use feature 'switch'; - - # Anonymous subroutine snippet asub - sub { + sub { ${1:# body } } @@ -156,19 +139,19 @@ snippet begin } # call package function with some parameter -snippet pkgmv +snippet pkgmv __PACKAGE__->${1:package_method}(${2:var}) # call package function without a parameter -snippet pkgm +snippet pkgm __PACKAGE__->${1:package_method}() # call package "get_" function without a parameter -snippet pkget +snippet pkget __PACKAGE__->get_${1:package_method}() # call package function with a parameter -snippet pkgetv +snippet pkgetv __PACKAGE__->get_${1:package_method}(${2:var}) # complex regex @@ -183,10 +166,10 @@ snippet qr/ #given snippet given - given ($${1:var}) { + given ($${1:var}) { ${2:# cases} ${3:# default} - } + } # switch-like case snippet when @@ -212,7 +195,7 @@ snippet ppod ${1:ClassName} - ${2:ShortDesc} =head1 SYNOPSIS - + use $1; ${3:# synopsis...} @@ -224,7 +207,7 @@ snippet ppod =head1 INTERFACE - + =head1 DEPENDENCIES @@ -254,7 +237,7 @@ snippet parg =item Arguments - + =over 3 =item @@ -277,7 +260,6 @@ snippet parg =back - =back @@ -328,7 +310,7 @@ snippet tsub sub t${1:number}_${2:test_case} :Test(${3:num_of_tests}) { my $self = shift; ${4:# body} - + } # Test::Routine-style test From 8e6b144f68de6aa449c08264cd1f4f31a5b45534 Mon Sep 17 00:00:00 2001 From: William Travis Holton Date: Thu, 26 Jul 2012 21:41:52 +1200 Subject: [PATCH 20/97] create an inline documented subroutine --- snippets/perl.snippets | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index e8de8fb..bbc9e30 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -228,8 +228,17 @@ snippet psubi =cut +# inline documented subroutine +snippet subpod + =head2 $1 + Summarry of $1 + =cut + + sub ${1:subroutine_name} { + ${2:# body...} + } # Subroutine signature snippet parg =over 2 From b5bb673ee3aa8e74efe16e50cf3009c3098d9c7e Mon Sep 17 00:00:00 2001 From: William Travis Holton Date: Thu, 26 Jul 2012 21:44:58 +1200 Subject: [PATCH 21/97] corrected spelling mistake --- snippets/perl.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/perl.snippets b/snippets/perl.snippets index bbc9e30..9cebede 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -232,7 +232,7 @@ snippet psubi snippet subpod =head2 $1 - Summarry of $1 + Summary of $1 =cut From 6bbe8b5598c12bee7b49b0d45cb32feeba3b1ca4 Mon Sep 17 00:00:00 2001 From: Josh Bode Date: Fri, 10 Aug 2012 23:58:38 +1000 Subject: [PATCH 22/97] Added R snippets --- snippets/r.snippets | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 snippets/r.snippets diff --git a/snippets/r.snippets b/snippets/r.snippets new file mode 100644 index 0000000..44a2b9b --- /dev/null +++ b/snippets/r.snippets @@ -0,0 +1,32 @@ +snippet #! + #!/usr/bin/env Rscript + +# includes +snippet lib + library(${1:package}) +snippet req + require(${1:package}) +snippet source + source('${1:file}') + +# conditionals +snippet if + if (${1:condition}) { + ${2:code} + } +snippet else + else { + ${1:code} + } +snippet ei + else if (${1:condition}) { + ${2:code} + } + +# functions +snippet fun + ${1:name} = function (${2:variables}) { + ${3:code} + } +snippet ret + return(${1:code}) From b554adc78d95389b38a472232f40ec56ea1ec734 Mon Sep 17 00:00:00 2001 From: Josh Bode Date: Sat, 11 Aug 2012 00:44:45 +1000 Subject: [PATCH 23/97] Added *apply, **ply functions and array types. --- snippets/r.snippets | 65 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/snippets/r.snippets b/snippets/r.snippets index 44a2b9b..909e70d 100644 --- a/snippets/r.snippets +++ b/snippets/r.snippets @@ -14,7 +14,7 @@ snippet if if (${1:condition}) { ${2:code} } -snippet else +snippet el else { ${1:code} } @@ -30,3 +30,66 @@ snippet fun } snippet ret return(${1:code}) + +# dataframes, lists, etc +snippet df + ${1:name}[${2:rows}, ${3:cols}] +snippet c + c(${1:items}) +snippet li + list(${1:items}) +snippet mat + matrix(${1:data}, nrow=${2:rows}, ncol=${3:cols}) + +# apply functions +snippet apply + apply(${1:array}, ${2:margin}, ${3:function}) +snippet lapply + lapply(${1:list}, ${2:function}) +snippet sapply + lapply(${1:list}, ${2:function}) +snippet vapply + vapply(${1:list}, ${2:function}, ${3:type}) +snippet mapply + mapply(${1:function}, ${2:...}) +snippet tapply + tapply(${1:vector}, ${2:index}, ${3:function}) +snippet rapply + rapply(${1:list}, ${2:function}) + +# plyr functions +snippet dd + ddply(${1:frame}, ${2:variables}, ${3:function}) +snippet dl + dlply(${1:frame}, ${2:variables}, ${3:function}) +snippet da + daply(${1:frame}, ${2:variables}, ${3:function}) +snippet d_ + d_ply(${1:frame}, ${2:variables}, ${3:function}) + +snippet ad + adply(${1:array}, ${2:margin}, ${3:function}) +snippet al + alply(${1:array}, ${2:margin}, ${3:function}) +snippet aa + aaply(${1:array}, ${2:margin}, ${3:function}) +snippet a_ + a_ply(${1:array}, ${2:margin}, ${3:function}) + +snippet ld + ldply(${1:list}, ${2:function}) +snippet ll + llply(${1:list}, ${2:function}) +snippet la + laply(${1:list}, ${2:function}) +snippet l_ + l_ply(${1:list}, ${2:function}) + +snippet md + mdply(${1:matrix}, ${2:function}) +snippet ml + mlply(${1:matrix}, ${2:function}) +snippet ma + maply(${1:matrix}, ${2:function}) +snippet m_ + m_ply(${1:matrix}, ${2:function}) From db791bcc6fd40c719ffd45cb234189db4f58322d Mon Sep 17 00:00:00 2001 From: Camilo Payan Date: Wed, 15 Aug 2012 20:47:17 -0400 Subject: [PATCH 24/97] Added xslt snippets. Still going to work on it as time goes.w --- snippets/xslt.snippets | 97 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 snippets/xslt.snippets diff --git a/snippets/xslt.snippets b/snippets/xslt.snippets new file mode 100644 index 0000000..d61a547 --- /dev/null +++ b/snippets/xslt.snippets @@ -0,0 +1,97 @@ +snippet apply-templates with-param + + ${3}${4} + ${5} + +snippet apply-templates sort-by + + ${5} + ${6} + +snippet apply-templates + ${2} + +snippet attribute blank + ${2}${3} + +snippet attribute value-of + + + ${3} + +snippet call-template + + +snippet call-template with-param + + ${3}${4} + ${5} + +snippet choose + + + ${2} + ${3} + + +snippet copy-of + ${2} + +snippet for-each + ${2} + ${3} + +snippet if + ${2} + ${3} + +snippet import + ${2} + +snippet include + ${2} + +snippet otherwise + ${1} + + +snippet param + ${2} + ${3} + +snippet stylesheet + ${1} + + +snippet template + ${3} + + +snippet template named + ${2} + + +snippet text + ${1} + +snippet value-of + ${2} + +snippet variable blank + ${2} + + +snippet variable select + ${2} + +snippet when + ${2} + + +snippet with-param + ${2} + +snippet with-param select + + From a2f6b10a43c2a9661a8a6d3beca61256c9e338cb Mon Sep 17 00:00:00 2001 From: Camilo Payan Date: Wed, 15 Aug 2012 22:48:32 -0400 Subject: [PATCH 25/97] Caught a mistake in the attribute with value-of. Value-of wasn't self-closed. --- snippets/xslt.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/xslt.snippets b/snippets/xslt.snippets index d61a547..892e9db 100644 --- a/snippets/xslt.snippets +++ b/snippets/xslt.snippets @@ -16,7 +16,7 @@ snippet attribute blank snippet attribute value-of - + ${3} snippet call-template From 7d39c38115187869a2a826d7d00b5629d3949682 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Wed, 22 Aug 2012 00:03:10 -0400 Subject: [PATCH 26/97] fixing duplicate numbering in BEERWARE snippet. --- snippets/_.snippets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/snippets/_.snippets b/snippets/_.snippets index 081db1c..b3570a6 100644 --- a/snippets/_.snippets +++ b/snippets/_.snippets @@ -216,12 +216,12 @@ snippet APACHE ${3} snippet BEERWARE - ${1:one line to give the program's name and a brief description} - Copyright `strftime("%Y")` ${2:copyright holder} + ${2:one line to give the program's name and a brief description} + Copyright `strftime("%Y")` ${3:copyright holder} Licensed under the "THE BEER-WARE LICENSE" (Revision 42): ${1:`g:snips_author`} wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer or coffee in return - ${3} + ${4} From f5d6c75d482a650e17c432ea278265ced36186a3 Mon Sep 17 00:00:00 2001 From: Sebastian Wiesner Date: Fri, 24 Aug 2012 12:28:08 +0200 Subject: [PATCH 27/97] Add comment argument to cite snippet --- snippets/tex.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/tex.snippets b/snippets/tex.snippets index 511a4c9..34893f5 100644 --- a/snippets/tex.snippets +++ b/snippets/tex.snippets @@ -146,9 +146,9 @@ snippet page ${1:page}~\pageref{${2}}${3} snippet index \index{${1:index}}${2} -#cite +#Citations snippet cite - \cite{${1}}${2} + \cite[${1}]{${2}}${3} #Formating text: italic, bold, underline, small capital, emphase .. snippet it \textit{${1:text}} From 494243d248a500bb703ac8e6bb749c700ec5f2a7 Mon Sep 17 00:00:00 2001 From: Sebastian Wiesner Date: Fri, 24 Aug 2012 12:32:36 +0200 Subject: [PATCH 28/97] Add snippet for footnote citations with biblatex --- snippets/tex.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/tex.snippets b/snippets/tex.snippets index 34893f5..6631c02 100644 --- a/snippets/tex.snippets +++ b/snippets/tex.snippets @@ -149,6 +149,8 @@ snippet index #Citations snippet cite \cite[${1}]{${2}}${3} +snippet fcite + \footcite[${1}]{${2}}${3} #Formating text: italic, bold, underline, small capital, emphase .. snippet it \textit{${1:text}} From 0e91c0589bd221d3eaf60715a6c23d71f51301eb Mon Sep 17 00:00:00 2001 From: Sebastian Wiesner Date: Fri, 24 Aug 2012 14:56:49 +0200 Subject: [PATCH 29/97] Remove fold markers from tex snippets tex.vim supports syntactic folding out of the box, set "let g:tex_fold_enabled=1" --- snippets/tex.snippets | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/snippets/tex.snippets b/snippets/tex.snippets index 511a4c9..8836d65 100644 --- a/snippets/tex.snippets +++ b/snippets/tex.snippets @@ -1,5 +1,3 @@ -# recomendation: change the fold marker from {{{,}}} to (fold),(end) ; tex uses "{" and "}" a lot - #PREAMBLE #newcommand snippet nc @@ -97,40 +95,34 @@ snippet part % part $2 (end) # Chapter snippet cha - \chapter{${1:chapter name}} % (fold) + \chapter{${1:chapter name}} \label{cha:${2:$1}} ${3} - % chapter $2 (end) # Section snippet sec - \section{${1:section name}} % (fold) + \section{${1:section name}} \label{sec:${2:$1}} ${3} - % section $2 (end) # Sub Section snippet sub - \subsection{${1:subsection name}} % (fold) + \subsection{${1:subsection name}} \label{sub:${2:$1}} ${3} - % subsection $2 (end) # Sub Sub Section snippet subs - \subsubsection{${1:subsubsection name}} % (fold) + \subsubsection{${1:subsubsection name}} \label{ssub:${2:$1}} ${3} - % subsubsection $2 (end) # Paragraph snippet par - \paragraph{${1:paragraph name}} % (fold) + \paragraph{${1:paragraph name}} \label{par:${2:$1}} ${3} - % paragraph $2 (end) # Sub Paragraph snippet subp - \subparagraph{${1:subparagraph name}} % (fold) + \subparagraph{${1:subparagraph name}} \label{subp:${2:$1}} ${3} - % subparagraph $2 (end) #References snippet itd \item[${1:description}] ${2:item} From 8108ecd9808a69d397cfc8d5f3258734f1243ea5 Mon Sep 17 00:00:00 2001 From: Aaron Broder Date: Mon, 27 Aug 2012 14:01:57 -0700 Subject: [PATCH 30/97] [cpp] Added C++11-style foreach snippet. --- snippets/cpp.snippets | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index c177a15..40e9253 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -64,3 +64,8 @@ snippet scin std::cin >> ${1}; snippet cin cin >> ${1}; +# foreach +snippet fore + for (${1:auto} ${2:i} : ${3:container}) { + ${4:/* code */} + } From 7fe10931b2ace47daa2356ea6c013f407ce6a4c3 Mon Sep 17 00:00:00 2001 From: Aaron Broder Date: Mon, 27 Aug 2012 14:10:27 -0700 Subject: [PATCH 31/97] [cpp] Reorganized snippets for consistency. Added comments to snippets that didn't have any. Reordered snippets so relevant snippets were close together. Removed cout/cin snippets for consistency with other snippets in std namespace. --- snippets/cpp.snippets | 86 +++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 44 deletions(-) diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index 40e9253..52a8c4b 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -1,28 +1,17 @@ -# Read File Into Vector -snippet readfile - std::vector v; - if (FILE *${2:fp} = fopen(${1:"filename"}, "r")) { - char buf[1024]; - while (size_t len = fread(buf, 1, sizeof(buf), $2)) - v.insert(v.end(), buf, buf + len); - fclose($2); - }${3} - +# std::vector +snippet vector + std::vector<${1:char}> ${2}; # std::map snippet map std::map<${1:key}, ${2:value}> ${3}; -# std::vector -snippet vector - std::vector<${1:char}> ${2}; - -# Namespace -snippet ns - namespace ${1:`Filename('', 'my')`} { - ${2} - } /* namespace $1 */ - -# Class +# std::cout +snippet cout + std::cout << ${1} << std::endl; +# std::cin +snippet cin + std::cin >> ${1}; +# class snippet class class ${1:`Filename('$1', 'name')`} { @@ -34,38 +23,47 @@ snippet class ${3:/* data */} }; +# member function implementations +snippet mfun + ${4:void} ${1:`Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) { + ${5:return}; + } +# namespace +snippet ns + namespace ${1:`Filename('', 'my')`} { + ${2} + } /* namespace $1 */ + +# for i loop snippet fori for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) { ${4:/* code */} } +# foreach +snippet fore + for (${1:auto} ${2:i} : ${3:container}) { + ${4:/* code */} + } +# iterator +snippet iter + for (${1:std::vector}<${2:type}>::${3:const_iterator} ${4:i} = ${5:container}.begin(); $4 != $5.end(); ++$4) { + ${6} + } + # auto iterator snippet itera for (auto ${1:i} = $1.begin(); $1 != $1.end(); ++$1) { ${2:std::cout << *$1 << std::endl;} } -# iterator -snippet iter - for (${1:std::vector}<${2:type}>::${3:const_iterator} ${4:i} = ${5:container}.begin(); $4 != $5.end(); ++$4) { - ${6} - } +# read file into vector +snippet readfile + std::vector v; + if (FILE *${2:fp} = fopen(${1:"filename"}, "r")) { + char buf[1024]; + while (size_t len = fread(buf, 1, sizeof(buf), $2)) + v.insert(v.end(), buf, buf + len); + fclose($2); + }${3} -# member function implementations -snippet mfun - ${4:void} ${1:`Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) { - ${5:return}; - } -snippet scout - std::cout << ${1} << std::endl; -snippet cout - cout << ${1} << endl; -snippet scin - std::cin >> ${1}; -snippet cin - cin >> ${1}; -# foreach -snippet fore - for (${1:auto} ${2:i} : ${3:container}) { - ${4:/* code */} - } From bc0e5b9301d8f6cbbabfde30cea7bdbe81b64c15 Mon Sep 17 00:00:00 2001 From: Aaron Broder Date: Mon, 27 Aug 2012 19:03:58 -0700 Subject: [PATCH 32/97] Added myself to AUTHORS --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 30c65d9..1063d97 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,3 +1,4 @@ +Aaron Broder Adam Folmert Alberto Pose Angel Alonso From 32eef65402161c76bf92b97a17ea644416148070 Mon Sep 17 00:00:00 2001 From: Aaron Broder Date: Mon, 27 Aug 2012 21:24:47 -0700 Subject: [PATCH 33/97] Finished STL container snippets --- snippets/cpp.snippets | 48 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index 52a8c4b..f6c19f5 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -1,10 +1,52 @@ +## STL Collections +# std::array +snippet array + std::array<${1:T}, ${2:N}> ${2};${3} # std::vector snippet vector - std::vector<${1:char}> ${2}; + std::vector<${1:T}> ${2};${3} +# std::deque +snippet deque + std::deque<${1:T}> ${2};${3} +# std::forward_list +snippet flist + std::forward_list<${1:T}> ${2};${3} +# std::list +snippet list + std::list<${1:T}> ${2};${3} +# std::set +snippet set + std::set<${1:T}> ${2};{$3} # std::map snippet map - std::map<${1:key}, ${2:value}> ${3}; - + std::map<${1:Key}, ${2:T}> ${3};${4} +# std::multiset +snippet mset + std::multiset<${1:T}> ${2};${3} +# std::multimap +snippet mmap + std::multimap<${1:Key}, ${2:T}> ${3};${4} +# std::unordered_set +snippet uset + std::unordered_set<${1:T}> ${2};${3} +# std::unordered_map +snippet umap + std::unordered_map<${1:Key}, ${2:T}> ${3};${4} +# std::unordered_multiset +snippet umset + std::unordered_multiset<${1:T}> ${3};${4} +# std::unordered_multimap +snippet ummap + std::unordered_multimap<${1:Key}, ${2:T}> ${3};${4} +# std::stack +snippet stack + std::stack<${1:T}> ${2};${3} +# std::queue +snippet queue + std::queue<${1:T}> ${2};${3} +# std::priority_queue +snippet pqueue + std::priority_queue<${1:T}> ${2};${3} # std::cout snippet cout std::cout << ${1} << std::endl; From 3b952e73fad5b5d814d1bff57173c4ad3e9484d1 Mon Sep 17 00:00:00 2001 From: Aaron Broder Date: Tue, 28 Aug 2012 09:33:50 -0700 Subject: [PATCH 34/97] [cpp] Added access modifier snippets. --- snippets/cpp.snippets | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index f6c19f5..09d9998 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -47,6 +47,23 @@ snippet queue # std::priority_queue snippet pqueue std::priority_queue<${1:T}> ${2};${3} +## +## Access Modifiers +# private +snippet pr + private +# protected +snippet po + protected +# public +snippet pu + public +# friend +snippet fr + friend +# mutable +snippet mu + mutable # std::cout snippet cout std::cout << ${1} << std::endl; From 4700702ea54472cc37a42cf66e6798d625dd5415 Mon Sep 17 00:00:00 2001 From: Aaron Broder Date: Tue, 28 Aug 2012 09:41:16 -0700 Subject: [PATCH 35/97] [cpp] Created class section --- snippets/cpp.snippets | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index 09d9998..ed7be50 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -64,14 +64,10 @@ snippet fr # mutable snippet mu mutable -# std::cout -snippet cout - std::cout << ${1} << std::endl; -# std::cin -snippet cin - std::cin >> ${1}; +## +## Class # class -snippet class +snippet cl class ${1:`Filename('$1', 'name')`} { public: @@ -81,8 +77,7 @@ snippet class private: ${3:/* data */} }; - -# member function implementations +# member function implementation snippet mfun ${4:void} ${1:`Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) { ${5:return}; @@ -92,7 +87,12 @@ snippet ns namespace ${1:`Filename('', 'my')`} { ${2} } /* namespace $1 */ - +# std::cout +snippet cout + std::cout << ${1} << std::endl; +# std::cin +snippet cin + std::cin >> ${1}; # for i loop snippet fori for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) { From 6518bba15ff54e61a5196b540219ec498bf999a7 Mon Sep 17 00:00:00 2001 From: Aaron Broder Date: Tue, 28 Aug 2012 09:43:20 -0700 Subject: [PATCH 36/97] [cpp] Created input/output section. --- snippets/cpp.snippets | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index ed7be50..1ccdc51 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -87,12 +87,24 @@ snippet ns namespace ${1:`Filename('', 'my')`} { ${2} } /* namespace $1 */ +## +## Input/Output # std::cout snippet cout std::cout << ${1} << std::endl; # std::cin snippet cin std::cin >> ${1}; +# read file into vector +snippet readfile + std::vector v; + if (FILE *${2:fp} = fopen(${1:"filename"}, "r")) { + char buf[1024]; + while (size_t len = fread(buf, 1, sizeof(buf), $2)) + v.insert(v.end(), buf, buf + len); + fclose($2); + }${3} + # for i loop snippet fori for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) { @@ -116,13 +128,3 @@ snippet itera ${2:std::cout << *$1 << std::endl;} } -# read file into vector -snippet readfile - std::vector v; - if (FILE *${2:fp} = fopen(${1:"filename"}, "r")) { - char buf[1024]; - while (size_t len = fread(buf, 1, sizeof(buf), $2)) - v.insert(v.end(), buf, buf + len); - fclose($2); - }${3} - From 260f24cccc271a551173854ac7fffb208844d669 Mon Sep 17 00:00:00 2001 From: Aaron Broder Date: Tue, 28 Aug 2012 09:44:24 -0700 Subject: [PATCH 37/97] [cpp] Added iteration section. --- snippets/cpp.snippets | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index 1ccdc51..637b249 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -105,7 +105,9 @@ snippet readfile fclose($2); }${3} -# for i loop +## +## Iteration +# for i snippet fori for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) { ${4:/* code */} From 06b2e3a1880a90978516024fcde40cc59870b87d Mon Sep 17 00:00:00 2001 From: Aaron Broder Date: Tue, 28 Aug 2012 10:34:24 -0700 Subject: [PATCH 38/97] [c] Added 'elif' snippet. --- snippets/c.snippets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snippets/c.snippets b/snippets/c.snippets index 38e8d9e..e17d064 100644 --- a/snippets/c.snippets +++ b/snippets/c.snippets @@ -50,6 +50,10 @@ snippet el else { ${1} } +snippet elif + else if (${1:/* condition */}) { + ${2:/* code */} + } # Ternary conditional snippet t ${1:/* condition */} ? ${2:a} : ${3:b} From 5ea5d2893a55d71ac9379351cdae0c107830ae98 Mon Sep 17 00:00:00 2001 From: Aaron Broder Date: Tue, 28 Aug 2012 10:56:17 -0700 Subject: [PATCH 39/97] [cpp] Minor bug fixes Fixed broken sequences on a few STL container snippets. Renamed the access modifier snippets to avoid conflicts. --- snippets/cpp.snippets | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index 637b249..b14f3d9 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -1,7 +1,7 @@ ## STL Collections # std::array snippet array - std::array<${1:T}, ${2:N}> ${2};${3} + std::array<${1:T}, ${2:N}> ${3};${4} # std::vector snippet vector std::vector<${1:T}> ${2};${3} @@ -16,7 +16,7 @@ snippet list std::list<${1:T}> ${2};${3} # std::set snippet set - std::set<${1:T}> ${2};{$3} + std::set<${1:T}> ${2};${3} # std::map snippet map std::map<${1:Key}, ${2:T}> ${3};${4} @@ -34,7 +34,7 @@ snippet umap std::unordered_map<${1:Key}, ${2:T}> ${3};${4} # std::unordered_multiset snippet umset - std::unordered_multiset<${1:T}> ${3};${4} + std::unordered_multiset<${1:T}> ${2};${3} # std::unordered_multimap snippet ummap std::unordered_multimap<${1:Key}, ${2:T}> ${3};${4} @@ -50,13 +50,13 @@ snippet pqueue ## ## Access Modifiers # private -snippet pr +snippet pri private # protected -snippet po +snippet pro protected # public -snippet pu +snippet pub public # friend snippet fr From 67c276b85dae8f3a16e7937312847b2c98283188 Mon Sep 17 00:00:00 2001 From: Aaron Broder Date: Tue, 28 Aug 2012 11:22:24 -0700 Subject: [PATCH 40/97] [c/cpp] Added postfix tab stop to most snippets This allows for people to quickly tab to the end of the snippet and continue writing code without having to exit insert mode. --- snippets/c.snippets | 24 ++++++++++++------------ snippets/cpp.snippets | 14 +++++++------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/snippets/c.snippets b/snippets/c.snippets index e17d064..8169614 100644 --- a/snippets/c.snippets +++ b/snippets/c.snippets @@ -27,11 +27,11 @@ snippet def snippet ifdef #ifdef ${1:FOO} ${2:#define } - #endif + #endif${3} snippet #if #if ${1:FOO} ${2} - #endif + #endif${3} # Header Include-Guard snippet once #ifndef ${1:`toupper(Filename('$1_H', 'UNTITLED_H'))`} @@ -45,15 +45,15 @@ snippet once snippet if if (${1:/* condition */}) { ${2:/* code */} - } + }${3} snippet el else { ${1} - } + }${2} snippet elif else if (${1:/* condition */}) { ${2:/* code */} - } + }${3} # Ternary conditional snippet t ${1:/* condition */} ? ${2:a} : ${3:b} @@ -61,28 +61,28 @@ snippet t snippet do do { ${2:/* code */} - } while (${1:/* condition */}); + } while (${1:/* condition */});${3} # While Loop snippet wh while (${1:/* condition */}) { ${2:/* code */} - } + }${3} # For Loop snippet for for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { ${4:/* code */} - } + }${5} # Custom For Loop snippet forr for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { ${5:/* code */} - } + }${6} # Function snippet fun ${1:void} ${2:function_name}(${3}) { ${4:/* code */} - } + }${5} # Function Declaration snippet fund ${1:void} ${2:function_name}(${3});${4} @@ -98,12 +98,12 @@ snippet st snippet tds typedef struct ${2:_$1 }{ ${3:/* data */} - } ${1:`Filename('$1_t', 'name')`}; + } ${1:`Filename('$1_t', 'name')`};${4} # Typdef enum snippet tde typedef enum { ${1:/* data */} - } ${2:foo}; + } ${2:foo};${3} # printf # unfortunately version this isn't as nice as TextMates's, given the lack of a # dynamic `...` diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index b14f3d9..9aea849 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -80,7 +80,7 @@ snippet cl # member function implementation snippet mfun ${4:void} ${1:`Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) { - ${5:return}; + ${5:/* code */} } # namespace snippet ns @@ -91,10 +91,10 @@ snippet ns ## Input/Output # std::cout snippet cout - std::cout << ${1} << std::endl; + std::cout << ${1} << std::endl;${2} # std::cin snippet cin - std::cin >> ${1}; + std::cin >> ${1};${2} # read file into vector snippet readfile std::vector v; @@ -111,22 +111,22 @@ snippet readfile snippet fori for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) { ${4:/* code */} - } + }${5} # foreach snippet fore for (${1:auto} ${2:i} : ${3:container}) { ${4:/* code */} - } + }${5} # iterator snippet iter for (${1:std::vector}<${2:type}>::${3:const_iterator} ${4:i} = ${5:container}.begin(); $4 != $5.end(); ++$4) { ${6} - } + }${7} # auto iterator snippet itera for (auto ${1:i} = $1.begin(); $1 != $1.end(); ++$1) { ${2:std::cout << *$1 << std::endl;} - } + }${3} From e7d5983bfcd8d0bb4234e7597ac3d97bad938a39 Mon Sep 17 00:00:00 2001 From: Aaron Broder Date: Tue, 28 Aug 2012 11:41:46 -0700 Subject: [PATCH 41/97] [c] Reorganized to match cpp snippets --- snippets/c.snippets | 75 ++++++++++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 28 deletions(-) diff --git a/snippets/c.snippets b/snippets/c.snippets index 8169614..35c87be 100644 --- a/snippets/c.snippets +++ b/snippets/c.snippets @@ -1,38 +1,45 @@ -# main() +## Main +# main snippet main int main(int argc, const char *argv[]) { ${1} return 0; } +# main(void) snippet mainn int main(void) { ${1} return 0; } +## +## Preprocessor # #include <...> snippet inc #include <${1:stdio}.h>${2} # #include "..." snippet Inc #include "${1:`Filename("$1.h")`}"${2} -# #ifndef ... #define ... #endif -snippet Def +# ifndef...define...endif +snippet ndef #ifndef $1 #define ${1:SYMBOL} ${2:value} #endif${3} +# define snippet def #define +# ifdef...endif snippet ifdef #ifdef ${1:FOO} ${2:#define } #endif${3} +# if snippet #if #if ${1:FOO} ${2} - #endif${3} -# Header Include-Guard + #endif +# header include guard snippet once #ifndef ${1:`toupper(Filename('$1_H', 'UNTITLED_H'))`} @@ -41,77 +48,89 @@ snippet once ${2} #endif /* end of include guard: $1 */ -# If Condition +## +## Control Statements +# if snippet if if (${1:/* condition */}) { ${2:/* code */} }${3} +# else snippet el else { ${1} - }${2} + }${3} +# else if snippet elif else if (${1:/* condition */}) { ${2:/* code */} }${3} -# Ternary conditional +# ternary snippet t ${1:/* condition */} ? ${2:a} : ${3:b} -# Do While Loop -snippet do - do { - ${2:/* code */} - } while (${1:/* condition */});${3} -# While Loop -snippet wh - while (${1:/* condition */}) { - ${2:/* code */} - }${3} -# For Loop +## +## Loops +# for snippet for for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { ${4:/* code */} }${5} -# Custom For Loop +# for (custom) snippet forr for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { ${5:/* code */} }${6} -# Function +# while +snippet wh + while (${1:/* condition */}) { + ${2:/* code */} + }${3} +# do... while +snippet do + do { + ${2:/* code */} + } while (${1:/* condition */});${3} +## +## Functions +# function definition snippet fun ${1:void} ${2:function_name}(${3}) { ${4:/* code */} }${5} -# Function Declaration +# function declaration snippet fund ${1:void} ${2:function_name}(${3});${4} -# Typedef +## +## Types +# typedef snippet td typedef ${1:int} ${2:MyCustomType};${3} -# Struct +# struct snippet st struct ${1:`Filename('$1_t', 'name')`} { ${2:/* data */} }${3: /* optional variable list */};${4} -# Typedef struct +# typedef struct snippet tds typedef struct ${2:_$1 }{ ${3:/* data */} } ${1:`Filename('$1_t', 'name')`};${4} -# Typdef enum +# typedef enum snippet tde typedef enum { ${1:/* data */} } ${2:foo};${3} +## +## Input/Output # printf -# unfortunately version this isn't as nice as TextMates's, given the lack of a -# dynamic `...` snippet pr printf("${1:%s}\n"${2});${3} # fprintf (again, this isn't as nice as TextMate's version, but it works) snippet fpr fprintf(${1:stderr}, "${2:%s}\n"${3});${4} +## +## Miscellaneous # This is kind of convenient snippet . [${1}]${2} From e80158c9985b2d1fe66669529a4bc65ad6057ad4 Mon Sep 17 00:00:00 2001 From: Eustaquio Rangel Date: Wed, 29 Aug 2012 09:14:08 -0300 Subject: [PATCH 42/97] Removed the newline after the test snippet --- snippets/ruby.snippets | 1 - 1 file changed, 1 deletion(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 26bdfa5..37826f3 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -865,7 +865,6 @@ snippet test test "should ${1:do something}" do ${2} end - #migrations snippet mac add_column :${1:table_name}, :${2:column_name}, :${3:data_type} From a3e5bbed2bfbb26f35b1446e8130482221fb5227 Mon Sep 17 00:00:00 2001 From: Aaron Broder Date: Fri, 31 Aug 2012 14:53:39 -0700 Subject: [PATCH 43/97] [cpp] Added C++11 lambda snippets --- snippets/cpp.snippets | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index 9aea849..59c7749 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -129,4 +129,13 @@ snippet itera for (auto ${1:i} = $1.begin(); $1 != $1.end(); ++$1) { ${2:std::cout << *$1 << std::endl;} }${3} - +## +## Lambdas +# lamda (one line) +snippet ld + [${1}](${2}){${3:/* code */}}${4} +# lambda (multi-line) +snippet lld + [${1}](${2}){ + ${3:/* code */} + }${4} From 03b7d9e98be5723e26a4b2143d09720dfa8b42b4 Mon Sep 17 00:00:00 2001 From: Aaron Broder Date: Fri, 31 Aug 2012 14:56:09 -0700 Subject: [PATCH 44/97] [cpp] Removed readfile snippet. The snippet doesn't use expected C++ practices for reading files and is more of a Textmate legacy. --- snippets/cpp.snippets | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index 59c7749..c3e19fe 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -95,16 +95,6 @@ snippet cout # std::cin snippet cin std::cin >> ${1};${2} -# read file into vector -snippet readfile - std::vector v; - if (FILE *${2:fp} = fopen(${1:"filename"}, "r")) { - char buf[1024]; - while (size_t len = fread(buf, 1, sizeof(buf), $2)) - v.insert(v.end(), buf, buf + len); - fclose($2); - }${3} - ## ## Iteration # for i From d451f3ebb10b2ef334b19f4d1bbdb2c7aef962ae Mon Sep 17 00:00:00 2001 From: Chipairon Date: Wed, 5 Sep 2012 15:35:08 +0200 Subject: [PATCH 45/97] Added missing " to footer. and footer# --- snippets/html.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/html.snippets b/snippets/html.snippets index be8b0f6..43ad84b 100644 --- a/snippets/html.snippets +++ b/snippets/html.snippets @@ -353,11 +353,11 @@ snippet footer ${1} snippet footer. -
${2}
snippet footer# -
${2}
snippet form From efeda76620b00f7e2000be6b005fa2e2e22e854f Mon Sep 17 00:00:00 2001 From: Erik Westrup Date: Fri, 7 Sep 2012 18:50:11 -0700 Subject: [PATCH 46/97] Did not consider Gecos field last time. --- AUTHORS | 1 + snippets/java.snippets | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 1063d97..1261dc8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -37,3 +37,4 @@ Povilas Balzaravičius Pawka Dmitry Dementev Travis Holton Chrisyue +Erik Westrup diff --git a/snippets/java.snippets b/snippets/java.snippets index fb27b9c..2d4568a 100644 --- a/snippets/java.snippets +++ b/snippets/java.snippets @@ -140,7 +140,7 @@ snippet /** * ${1} */ snippet @au - @author `system("grep \`id -un\` /etc/passwd | cut -d \":\" -f5")` + @author `system("grep \`id -un\` /etc/passwd | cut -d \":\" -f5 | cut -d \",\" -f1")` snippet @br @brief ${1:Description} snippet @fi From e1e10b91617e8af4475b16464d0944777b6a6d89 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Tue, 25 Sep 2012 17:05:04 -0300 Subject: [PATCH 47/97] Added 'for in do' coffeescript snippet --- snippets/coffee.snippets | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/snippets/coffee.snippets b/snippets/coffee.snippets index dfe3658..df537a9 100644 --- a/snippets/coffee.snippets +++ b/snippets/coffee.snippets @@ -1,3 +1,8 @@ +# Closure loop +snippet forindo + for ${1:name} in ${2:array} + do (${1:name}) -> + ${3:// body} # Array comprehension snippet fora for ${1:name} in ${2:array} From 861b95272b9a7efb65dd628320798940fd8e3e9f Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Tue, 25 Sep 2012 17:42:44 -0300 Subject: [PATCH 48/97] Fixed 'for in do' snippet to mirror the loop variable in the 'do' parameter --- snippets/coffee.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/coffee.snippets b/snippets/coffee.snippets index df537a9..1461cc6 100644 --- a/snippets/coffee.snippets +++ b/snippets/coffee.snippets @@ -1,7 +1,7 @@ # Closure loop snippet forindo for ${1:name} in ${2:array} - do (${1:name}) -> + do ($1) -> ${3:// body} # Array comprehension snippet fora From a1af06d5fa780264de8a8a11133e6b54a2c80015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Guimar=C3=A3es?= Date: Tue, 25 Sep 2012 20:03:18 -0300 Subject: [PATCH 49/97] Create a encoding snippet for Ruby 1.9 --- snippets/ruby.snippets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 37826f3..f41f027 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -2,6 +2,10 @@ # Ruby snippets - for Rails, see below # ######################################## +# encoding for Ruby 1.9 +snippet enc + # encoding: utf-8 + # #!/usr/bin/env ruby snippet #! #!/usr/bin/env ruby From 8fd3644f76a0d42574209ac4fe0adababe22857c Mon Sep 17 00:00:00 2001 From: Jeffrey Tratner Date: Thu, 27 Sep 2012 17:51:09 -0400 Subject: [PATCH 50/97] [coffee] added export snippet --- snippets/coffee.snippets | 3 +++ 1 file changed, 3 insertions(+) diff --git a/snippets/coffee.snippets b/snippets/coffee.snippets index 1461cc6..83b77eb 100644 --- a/snippets/coffee.snippets +++ b/snippets/coffee.snippets @@ -90,3 +90,6 @@ snippet try # Require snippet req ${2:$1} = require '${1:sys}'${3} +# Export +snippet exp + ${1:root} = exports ? this From 9a08f7decdf5e2a5e77009dadb18a07d0e143bd7 Mon Sep 17 00:00:00 2001 From: HIRAKI Satoru Date: Sun, 30 Sep 2012 19:53:44 +0900 Subject: [PATCH 51/97] improved tertiary conditional & improved switch --- snippets/javascript.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/javascript.snippets b/snippets/javascript.snippets index de50a0c..5b1caf7 100644 --- a/snippets/javascript.snippets +++ b/snippets/javascript.snippets @@ -32,11 +32,11 @@ snippet ife ${3} } # tertiary conditional -snippet t +snippet ter ${1:/* condition */} ? ${2:a} : ${3:b} # switch snippet switch - switch(${1:expression}) { + switch (${1:expression}) { case '${3:case}': ${4:// code} break; From 1c0e3ee7da1e5075a6463fad7792b509149f4dbb Mon Sep 17 00:00:00 2001 From: jonasac Date: Mon, 1 Oct 2012 00:04:56 +0200 Subject: [PATCH 52/97] Fix some typos in java print snippets --- snippets/java.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/java.snippets b/snippets/java.snippets index 2d4568a..854f14a 100644 --- a/snippets/java.snippets +++ b/snippets/java.snippets @@ -176,9 +176,9 @@ snippet main ## ## Print Methods snippet print - System.out.print("${1:Message"); + System.out.print("${1:Message}"); snippet printf - System.out.printf("${1:Message", ${2:args}); + System.out.printf("${1:Message}", ${2:args}); snippet println System.out.println(${1}); ## From 7387b15ebf339418de25781c16a577a40de73643 Mon Sep 17 00:00:00 2001 From: theocrite Date: Fri, 12 Oct 2012 18:05:42 +0300 Subject: [PATCH 53/97] Added WTFPL licence. --- snippets/_.snippets | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/snippets/_.snippets b/snippets/_.snippets index b3570a6..fd249e7 100644 --- a/snippets/_.snippets +++ b/snippets/_.snippets @@ -225,3 +225,16 @@ snippet BEERWARE this stuff is worth it, you can buy me a beer or coffee in return ${4} + +snipper WTFPL + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION From e3c5655b0ff11ad6c15e287b59e351b55c4a6c1b Mon Sep 17 00:00:00 2001 From: Kalinin Eugene Date: Fri, 12 Oct 2012 19:30:05 +0400 Subject: [PATCH 54/97] added sql/plsql snippets --- snippets/plsql.snippets | 109 ++++++++++++++++++++++++++++++++++++++++ snippets/sql.snippets | 26 ++++++++++ 2 files changed, 135 insertions(+) create mode 100644 snippets/plsql.snippets create mode 100644 snippets/sql.snippets diff --git a/snippets/plsql.snippets b/snippets/plsql.snippets new file mode 100644 index 0000000..dba25ee --- /dev/null +++ b/snippets/plsql.snippets @@ -0,0 +1,109 @@ +# create package spec +snippet ps + create or replace package ${1:name} + as + ${2:-- spec} + end; -- end of package spec $1 +# create package body +snippet pb + create or replace package body ${1:name} + as + ${2:-- body} + end; -- end of package body $1; +# package procedure spec +snippet pps + procedure ${1:name}(${2:args}); +# package procedure body +snippet ppb + procedure ${1:name}(${2:args}) + as + begin + ${3:-- body} + end $2; +# package function spec +snippet pfs + function ${1:name}(${2:args}) + return ${3:type}; +# package function body +snippet pfb + function ${1:name}(${2:args}) + return ${3:type} + as + l_res $3; + begin + ${4:-- body}; + return l_res; + end $1; +# snow errors +snippet err + show errors; +# proc/func in parameter +snippet p + ${1:name} ${2:in} ${3:type} ${4: := null} +# package type: record +snippet tr + type tr_${1:name} is record (${2:/* columns */}); +# package type: nested table +snippet tt + type tt_${1:name} is table of tr_${2:name}; +# package type: indexed table +snippet tti + type tt_${1:name} is table of tr_${2:name} index by binary_integer; +# proc/func comment +snippet doc + /* + * ${1: comment ...} + */ +# plsql block +snippet beg + begin + ${1} + end; +# plsql block with declare part +snippet dec + declare + ${1} + begin + ${2} + end; +# return pipe row +snippet rpipe + for ${1:i} in 1 .. ${2:l_res}.count loop + pipe row( $2($1) ); + end loop; + return; +# bulk collect +snippet bc + bulk collect into ${1} +# local variable +snippet l + l_${1} ${2:number}; +# output +snippet log + dbms_output.put_line('${1}'); +# for loop +snippet for + for ${1:i} in ${2:1}..${3:42} loop + ${3} + end loop; +# for loop with select +snippet fors + for ${1:rec} in (${2: select}) loop + ${3} + end loop; +# for loop with collection +snippet forc + for ${1:i} in ${2:l_var}.first .. $2.last loop + ${3: -- dbms_output.put_line($2($1)); } + end loop; +# if +snippet if + if ${1} then + ${2} + end if; +snippet ife + if ${1} then + ${2} + else + ${3} + end if; diff --git a/snippets/sql.snippets b/snippets/sql.snippets new file mode 100644 index 0000000..eb4b37c --- /dev/null +++ b/snippets/sql.snippets @@ -0,0 +1,26 @@ +snippet tbl + create table ${1:table} ( + ${2:columns} + ); +snippet col + ${1:name} ${2:type} ${3:default ''} ${4:not null} +snippet ccol + ${1:name} varchar2(${2:size}) ${3:default ''} ${4:not null} +snippet ncol + ${1:name} number ${3:default 0} ${4:not null} +snippet dcol + ${1:name} date ${3:default sysdate} ${4:not null} +snippet ind + create index ${3:$1_$2} on ${1:table}(${2:column}); +snippet uind + create unique index ${1:name} on ${2:table}(${3:column}); +snippet tblcom + comment on table ${1:table} is '${2:comment}'; +snippet colcom + comment on column ${1:table}.${2:column} is '${3:comment}'; +snippet addcol + alter table ${1:table} add (${2:column} ${3:type}); +snippet seq + create sequence ${1:name} start with ${2:1} increment by ${3:1} minvalue ${4:1}; +snippet s* + select * from ${1:table} From 12ddfd362af05f038821e6bc582bbc8798889aee Mon Sep 17 00:00:00 2001 From: theocrite Date: Mon, 15 Oct 2012 12:55:37 +0300 Subject: [PATCH 55/97] Added WTFPL licence. --- snippets/_.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/_.snippets b/snippets/_.snippets index fd249e7..9d62d97 100644 --- a/snippets/_.snippets +++ b/snippets/_.snippets @@ -226,7 +226,7 @@ snippet BEERWARE ${4} -snipper WTFPL +snippet WTFPL DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 From 7b3fe9d9c64d2efe8b19b347a4ca66e443acc7fe Mon Sep 17 00:00:00 2001 From: theocrite Date: Mon, 15 Oct 2012 14:10:42 +0300 Subject: [PATCH 56/97] Added WTFPL licence. --- snippets/_.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/_.snippets b/snippets/_.snippets index 9d62d97..826ec9e 100644 --- a/snippets/_.snippets +++ b/snippets/_.snippets @@ -230,7 +230,7 @@ snippet WTFPL DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 - Copyright (C) 2004 Sam Hocevar +Copyright `strftime("%Y")` ${1:copyright holder} Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long From 28ce3bb6f4ac2048366a88746000e91e2388942b Mon Sep 17 00:00:00 2001 From: Jack Stalnaker Date: Thu, 18 Oct 2012 16:27:02 -0500 Subject: [PATCH 57/97] added switch, switch with no default, and case snippets to c snippets --- snippets/c.snippets | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/snippets/c.snippets b/snippets/c.snippets index 35c87be..72ce3d0 100644 --- a/snippets/c.snippets +++ b/snippets/c.snippets @@ -68,6 +68,27 @@ snippet elif # ternary snippet t ${1:/* condition */} ? ${2:a} : ${3:b} +# switch +snippet switch + switch (${1:/* variable */}) { + case ${2:/* variable case */}: + ${3} + ${4:break;}${5} + default: + ${6} + }${7} +# switch without default +snippet switchndef + switch (${1:/* variable */}) { + case ${2:/* variable case */}: + ${3} + ${4:break;}${5} + }${6} +# case +snippet case + case ${1:/* variable case */}: + ${2} + ${3:break;}${4} ## ## Loops # for From d66eaaf88e674cde8081c564b2baa7e059b0e787 Mon Sep 17 00:00:00 2001 From: "David Deryl Downey - AKA Deryl R. Doucette" Date: Thu, 18 Oct 2012 23:21:11 -0300 Subject: [PATCH 58/97] Changed patfh to fpath. Makes sense due to context --- snippets/ruby.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index f41f027..63ec178 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -394,7 +394,7 @@ snippet : snippet ope open(${1:"path/or/url/or/pipe"}, "${2:w}") { |${3:io}| ${4} } # path_from_here() -snippet patfh +snippet fpath File.join(File.dirname(__FILE__), *%2[${1:rel path here}])${2} # unix_filter {} snippet unif From d115300c98a039de5eeebe881aea04217d38e963 Mon Sep 17 00:00:00 2001 From: Jim Deville Date: Fri, 19 Oct 2012 12:16:48 -0700 Subject: [PATCH 59/97] Delete duplicate snippet --- snippets/eruby.snippets | 4 ---- 1 file changed, 4 deletions(-) diff --git a/snippets/eruby.snippets b/snippets/eruby.snippets index be1c7ec..f96ca84 100644 --- a/snippets/eruby.snippets +++ b/snippets/eruby.snippets @@ -81,10 +81,6 @@ snippet fields <% fields_for :${1:model}, @$1 do |${2:f}| %> ${3} <% end %> -snippet ff - <%= form_for @${1:model} do |f| %> - ${2} - <% end %> snippet i18 I18n.t('${1:type.key}')${2} snippet it From 7b5f878886400232740cef073857138cb66edd45 Mon Sep 17 00:00:00 2001 From: theocrite Date: Wed, 24 Oct 2012 14:48:06 +0300 Subject: [PATCH 60/97] Adding a html5 snippet This html5 snippet would provide the minimum someone could expect in a html5 file. --- snippets/html.snippets | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/snippets/html.snippets b/snippets/html.snippets index 43ad84b..0f75efd 100644 --- a/snippets/html.snippets +++ b/snippets/html.snippets @@ -445,6 +445,18 @@ snippet xhtml ${1} +snippet html5 + + + + + ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} + ${2:meta} + + + ${3:body} + + snippet i ${1} snippet iframe From 699250051db16be18285bc190fa990a69dfd60cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ho=CC=88ltje?= Date: Sun, 28 Oct 2012 02:07:13 -0400 Subject: [PATCH 61/97] Added descriptions for duplicated snippet names. This is to make the snippets a little more compatible with neosnippets. --- snippets/actionscript.snippets | 2 +- snippets/ruby.snippets | 4 ++-- snippets/xslt.snippets | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/snippets/actionscript.snippets b/snippets/actionscript.snippets index 999b8a3..af9611c 100644 --- a/snippets/actionscript.snippets +++ b/snippets/actionscript.snippets @@ -107,7 +107,7 @@ snippet try ${3} } # For Loop (same as c.snippet) -snippet for +snippet for for (..) {..} for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { ${4:/* code */} } diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 63ec178..0500aaa 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -26,7 +26,7 @@ snippet beg rescue ${1:Exception} => ${2:e} end -snippet req +snippet req require require "${1}"${2} snippet # # => @@ -575,7 +575,7 @@ snippet asre assert_response :${1:success}, @response.body${2} snippet asrj assert_rjs :${1:replace}, "${2:dom id}" -snippet ass +snippet ass assert_select(..) assert_select '${1:path}', :${2:text} => '${3:inner_html' ${4:do} snippet bf before_filter :${1:method} diff --git a/snippets/xslt.snippets b/snippets/xslt.snippets index 892e9db..e7abdf3 100644 --- a/snippets/xslt.snippets +++ b/snippets/xslt.snippets @@ -8,7 +8,7 @@ snippet apply-templates sort-by ${5}
${6} -snippet apply-templates +snippet apply-templates plain ${2} snippet attribute blank From 9a63deb18a0886ae9547feb1f820404698e29558 Mon Sep 17 00:00:00 2001 From: Jakub Stasiak Date: Sat, 3 Nov 2012 12:03:52 +0100 Subject: [PATCH 62/97] Use "# TODO: write code..." as code placeholder in Python snippets (#34) --- snippets/python.snippets | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/snippets/python.snippets b/snippets/python.snippets index b3b1e9b..7f58d98 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -13,16 +13,16 @@ snippet docs ''' snippet wh while ${1:condition}: - ${2:# code...} + ${2:# TODO: write code...} # dowh - does the same as do...while in other languages snippet dowh while True: - ${1:# code...} + ${1:# TODO: write code...} if ${2:condition}: break snippet with with ${1:expr} as ${2:var}: - ${3:# code...} + ${3:# TODO: write code...} # New Class snippet cl class ${1:ClassName}(${2:object}): @@ -35,14 +35,14 @@ snippet cl snippet def def ${1:fname}(${2:`indent('.') ? 'self' : ''`}): """${3:docstring for $1}""" - ${4:pass} + ${4:# TODO: write code...} snippet deff def ${1:fname}(${2:`indent('.') ? 'self' : ''`}): - ${3} + ${3:# TODO: write code...} # New Method snippet defs def ${1:mname}(self, ${2:arg}): - ${3:pass} + ${3:# TODO: write code...} # New Property snippet property def ${1:foo}(): @@ -54,17 +54,17 @@ snippet property # Ifs snippet if if ${1:condition}: - ${2:code...} + ${2:# TODO: write code...} snippet el else: - ${1:code...} + ${1:# TODO: write code...} snippet ei elif ${1:condition}: - ${2:code...} + ${2:# TODO: write code...} # For snippet for for ${1:item} in ${2:items}: - ${3:code...} + ${3:# TODO: write code...} # Encodes snippet cutf8 # -*- coding: utf-8 -*- @@ -79,32 +79,32 @@ snippet . self. snippet try Try/Except try: - ${1:pass} + ${1:# TODO: write code...} except ${2:Exception}, ${3:e}: ${4:raise $3} snippet try Try/Except/Else try: - ${1:pass} + ${1:# TODO: write code...} except ${2:Exception}, ${3:e}: ${4:raise $3} else: - ${5:pass} + ${5:# TODO: write code...} snippet try Try/Except/Finally try: - ${1:pass} + ${1:# TODO: write code...} except ${2:Exception}, ${3:e}: ${4:raise $3} finally: - ${5:pass} + ${5:# TODO: write code...} snippet try Try/Except/Else/Finally try: - ${1:pass} + ${1:# TODO: write code...} except ${2:Exception}, ${3:e}: ${4:raise $3} else: - ${5:pass} + ${5:# TODO: write code...} finally: - ${6:pass} + ${6:# TODO: write code...} # if __name__ == '__main__': snippet ifmain if __name__ == '__main__': @@ -130,12 +130,12 @@ snippet " # test function/method snippet test def test_${1:description}(${2:`indent('.') ? 'self' : ''`}): - ${3:pass} + ${3:# TODO: write code...} # test case snippet testcase class ${1:ExampleCase}(unittest.TestCase): def test_${2:description}(self): - ${3:pass} + ${3:# TODO: write code...} snippet fut from __future__ import ${1} From 4f236166c37a997f07d981bea9f1ab8dc3a795ad Mon Sep 17 00:00:00 2001 From: gk Date: Sat, 3 Nov 2012 15:52:52 +0400 Subject: [PATCH 63/97] fix for WTFPL --- snippets/_.snippets | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/snippets/_.snippets b/snippets/_.snippets index 826ec9e..d553449 100644 --- a/snippets/_.snippets +++ b/snippets/_.snippets @@ -227,14 +227,14 @@ snippet BEERWARE ${4} snippet WTFPL - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 -Copyright `strftime("%Y")` ${1:copyright holder} + Copyright `strftime("%Y")` ${1:copyright holder} - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION From 8ee1805a66d9ed4ab2c49a49e5d0664b722ce4b1 Mon Sep 17 00:00:00 2001 From: Jean Jordaan Date: Sun, 11 Nov 2012 16:24:36 +0700 Subject: [PATCH 64/97] Make the default text for RST more descriptive. --- snippets/rst.snippets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/snippets/rst.snippets b/snippets/rst.snippets index d31a13f..97845de 100644 --- a/snippets/rst.snippets +++ b/snippets/rst.snippets @@ -1,14 +1,14 @@ # rst snippet : - :${1:Text}: ${2:blah blah} + :${1:field name}: ${2:field body} snippet * *${1:Emphasis}* snippet ** **${1:Strong emphasis}** snippet _ - \`${1:Text}\`_ - .. _\`$1\`: ${2:blah blah} + \`${1:hyperlink-name}\`_ + .. _\`$1\`: ${2:link-block} snippet = ${1:Title} =====${2:=} From e7d5824daa242de5753feedee49ac1de712e7ca4 Mon Sep 17 00:00:00 2001 From: raydeal Date: Thu, 22 Nov 2012 22:25:28 +0100 Subject: [PATCH 65/97] add yii snippets --- snippets/yii-chtml.snippets | 248 +++++++++++++++++++++++++++++ snippets/yii.snippets | 300 ++++++++++++++++++++++++++++++++++++ 2 files changed, 548 insertions(+) create mode 100644 snippets/yii-chtml.snippets create mode 100644 snippets/yii.snippets diff --git a/snippets/yii-chtml.snippets b/snippets/yii-chtml.snippets new file mode 100644 index 0000000..91c65b9 --- /dev/null +++ b/snippets/yii-chtml.snippets @@ -0,0 +1,248 @@ +#--------------------Yii CHtml--------------------------------- +#Yii CHtml::radioButton +snippet yhrb + echo CHtml::radioButton('${1:name}', ${2:false},array(${3:optionName}=>${4:optionValue} ); + +#Yii CHtml::asset +snippet yhass + echo CHtml::asset('${1:path}'); + +#Yii CHtml::activeLabelEx +snippet yhale + echo CHtml::activeLabelEx(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::encodeArray +snippet yheca + echo CHtml::encodeArray(array(${1})); + +#Yii CHtml::normalizeUrl +snippet yhnurl + echo CHtml::normalizeUrl(array('${1}')); + +#Yii CHtml::resetButton +snippet yhsb + echo CHtml::submitButton('${1:label}',array('${2:optionName}'=>${3:optionValue})); + +#Yii CHtml::linkButton +snippet yhlinkb + echo CHtml::linkButton('${1:lable}',array('${2:optionName}'=>${3:optionValue})); + +#Yii CHtml::activeTextArea +snippet yhata + echo CHtml::activeTextArea(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::ajaxButton +snippet yhajb + echo CHtml::ajaxButton('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); + +#Yii CHtml::activeId +snippet yhai + echo CHtml::activeId(${1:model}, '${2:attribute}'); + +#Yii CHtml::activeCheckBox +snippet yhacb + echo CHtml::activeCheckBox(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::activeHiddenField +snippet yhahf + echo CHtml::activeHiddenField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::encode +snippet yhec + echo CHtml::encode(${1:text}); + +#Yii CHtml::metaTag +snippet yhmtag + echo CHtml::metaTag('${1:content}', '${2:name}', '${3:httpEquiv}',array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::dropDownList +snippet yhddl + echo CHtml::dropDownList('${1:name}', '${2:select}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::listBox +snippet yhlb + echo CHtml::listBox('${1:name}', '${2:select}',array(${3}),array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::script +snippet yhjs + echo CHtml::script('${1:test}'); + +#Yii CHtml::ajax +snippet yhaj + echo CHtml::ajax(array(${1})); + +#Yii CHtml::textField +snippet yhtf + echo CHtml::textField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::activePasswordField +snippet yhapf + echo CHtml::activePasswordField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::listData +snippet yhld + echo CHtml::listData(array(${1}),'${2:valueField}', '${3:textField}','${4:groupField}'); + +#Yii CHtml::mailto +snippet yhmt + echo CHtml::mailto('${1:text}', '${2:email}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::image +snippet yhimg + echo CHtml::image('${1:src}', '${2:alt}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::activeListBox +snippet yhalb + echo CHtml::activeListBox(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::activeFileField +snippet yhaff + echo CHtml::activeFileField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::closeTag +snippet yhct + echo CHtml::closeTag('${1:tag}'); + +#Yii CHtml::activeInputField +snippet yhaif + echo CHtml::activeInputField('${1:type}', ${2:model}, '${3:attribute}',array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::scriptFile +snippet yhjsf + echo CHtml::scriptFile('${1:url}'); + +#Yii CHtml::radioButtonList +snippet yhrbl + echo CHtml::radioButtonList('${1:name}', ${2:select}, array(${3}),array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::cssFile +snippet yhcssf + echo CHtml::cssFile('${1:url}','${2:media}'); + +#Yii CHtml::error +snippet yherr + echo CHtml::error(${1:model}, '${2:attribute}'); + +#Yii CHtml::passwordField +snippet yhpf + echo CHtml::passwordField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::hiddenField +snippet yhhf + echo CHtml::hiddenField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::cdata +snippet yhc + echo CHtml::cdata(${1:text}); + +#Yii CHtml::link +snippet yhlink + echo CHtml::link('${1:text}',array(${2}),array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::errorSummary +snippet yherrs + echo CHtml::errorSummary(${1:model},'${2:headerHtml}','${3:footerHtml}'); + +#Yii CHtml::tag +snippet yht + echo CHtml::tag('${1:tag}',array('${2:optionName}'=>${3:optionValue}),${4:false},${5:true}); + +#Yii CHtml::ajaxLink +snippet yhajl + echo CHtml::ajaxLink('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); + +#Yii CHtml::label +snippet yhlabel + echo CHtml::label('${1:label}', '${2:for}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::activeName +snippet yhan + echo CHtml::activeName(${1:model}, '${2:attribute}'); + +#Yii CHtml::statefulForm +snippet yhsform + echo CHtml::statefulForm(array('${1}'), '${2:post}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::fileField +snippet yhff + echo CHtml::fileField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::activeTextField +snippet yhatf + echo CHtml::activeTextField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::css +snippet yhcss + echo CHtml::css('${1:test}','${2:media}'); + +#Yii CHtml::imageButton +snippet yhimgb + echo CHtml::imageButton('${1:src}',array('${2:optionName}'=>${3:optionValue})); + +#Yii CHtml::ajaxSubmitButton +snippet yhajsb + echo CHtml::ajaxSubmitButton('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); + +#Yii CHtml::button +snippet yhb + echo CHtml::button('${1:label}',array('${2:optionName}'=>${3:optionValue})); + +#Yii CHtml::listOptions +snippet yhlo + echo CHtml::listOptions('${1:selection}', array(${2}), array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::activeCheckBoxList +snippet yhacbl + echo CHtml::activeCheckBoxList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::openTag +snippet yhot + echo CHtml::openTag('${1:tag}', array('${2:optionName}'=>${3:optionValue})); + +#Yii CHtml::checkBox +snippet yhcb + echo CHtml::checkBox('${1:name}', ${2:false}, array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::textArea +snippet yhta + echo CHtml::textArea('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::linkTag +snippet yhlinkt + echo CHtml::linkTag('${1:relation}', '${2:type}', '${3:href}', '${4:media}',array('${5:optionName}'=>${6:optionValue})); + +#Yii CHtml::resetButton +snippet yhrsb + echo CHtml::resetButton('${1:label}',array('${2:optionName}'=>${3:optionValue})); + +#Yii CHtml::activeRadioButtonList +snippet yharbl + echo CHtml::activeRadioButtonList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::checkBoxList +snippet yhcbl + echo CHtml::checkBoxList('${1:name}', ${2:select}, array(${3}),array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::form +snippet yhform + echo CHtml::form(array('${1}'), '${2:post}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::beginForm +snippet yhbeform + echo CHtml::beginForm(array('${1}'), '${2:post}',array('${3:optionName}'=>${4:optionValue})); + ${5} + echo CHtml::endForm(); + +#Yii CHtml::activeDropDownList +snippet yhaddl + echo CHtml::activeDropDownList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::activeRadioButton +snippet yharb + echo CHtml::activeRadioButton(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::activeLabel +snippet yhal + echo CHtml::activeLabel(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + + diff --git a/snippets/yii.snippets b/snippets/yii.snippets new file mode 100644 index 0000000..9f29eaf --- /dev/null +++ b/snippets/yii.snippets @@ -0,0 +1,300 @@ +#Yii session offset +snippet yse + Yii::app()->session['${1}']; + +#Yii renderDynamic +snippet yrd + $this->renderDynamic('${1:callback}'); + +#Yii set cache +snippet ycas + Yii::app()->cache->set('${1:key}', ${2:value}, ${3:expire}, new C${4:}CacheDependency(${5})); + +#Yii Add cache +snippet ycad + Yii::app()->cache->add('${1:key}', ${2:value}, ${3:expire}, new C${4}CacheDependency(${5})); + +#Yii register CSS file +snippet yregcf + Yii::app()->clientScript->registerCssFile('${1:file}'); + +#Yii requestType +snippet yreqtype + Yii::app()->request->requestType + +#Yii isAjaxRequest +snippet yisajax + Yii::app()->request->isAjaxRequest + +#Yii translate +snippet yt + Yii::t('${1:category}', '${2:message}',array(${3})); + +#Yii register CSS +snippet yregc + Yii::app()->clientScript->registerCss('${1:id}', '${2}'); + +#Yii log +snippet ylog + Yii::log('${1:msg}', '${2:info}'); + +#Yii userHostAddress +snippet yuserip + YYii::app()->request->userHostAddress + +#Yii register script file +snippet yregsf + Yii::app()->clientScript->registerScriptFile('${1:scriptUrl}', CClientScript::POS_${2:END}); + +#Yii CLinkPager +snippet ylinkpager + $this->widget('CLinkPager', array('pages'=>$pages,'header'=>'${1}'})) + +#Yii CJSON::encode +snippet yjec + CJSON::encode(${1:text}); + +#CActiveDataProvider +snippet yadp + $dataProvider = new CActiveDataProvider('${1}', array( + 'criteria' => array( + 'condition' => '${2}', + 'order' => '${3}', + 'with' => array('${4}') + ), + //'pagination' => false, + 'pagination' => array( + 'pageSize'=>${5}, + ), + )); + ${6} + // $dataProvider->getData() will return a list of Post objects + +#Yii renderDynamic internal +snippet yrdi + $this->renderDynamic('${1:callback}', array('${2:key}'=>${3:value})); + +#Yii register script +snippet yregs + Yii::app()->clientScript->registerScript('${1:id}', '${2}', CClientScript::POS_${3:READY}); + +#Yii Flush cache +snippet ycaf + Yii::app()->cache->flush(); + +#Yii Yii::app()->request->cookies +snippet yco + Yii::app()->request->cookies['${1}'] + +#Yii user-> +snippet yuser + Yii::app()->user->${1} + +#Yii refresh +snippet yrf + $this->refresh(); + +#Yii import +snippet yimp + Yii::import('${1}'); + +#Yii trace +snippet ytrace + Yii::trace('${1:msg}'); + +#Yii params +snippet ypar + Yii::app()->params['${1}'] + +#Yii isPostRequest +snippet yispost + Yii::app()->request->isPostRequest + +#Yii IF isAjaxRequest +snippet yifisajax + if(Yii::app()->request->isAjaxRequest == TRUE) + { + ${1} + } + +#Yii Yii::app()->cache->delete +snippet ydelcache + Yii::app()->cache->delete('${1:key}'); + +#Yii render view +snippet yr + $this->render('${1:view}',array('${2:key}'=>${3:value})); + +#Yii redirect +snippet yre + $this->redirect(array('${1:controller}/${2:action}')); + +#Yii Get cache +snippet ycag + Yii::app()->cache->get('${1:key}'); + +#Yii render text +snippet yrt + $this->renderText('${1}'); + +#Yii render partial +snippet yrp + $this->renderPartial('${1:view}',array('${2:key}'=>${3:value})); + +#----------------Yii Model----------------------------- +#Yii Model count +snippet ycountm + ${1:ModelName}::model()->count(${2:condition}, array('${3:key}'=>${4:value})); + +#Yii Model countBySql +snippet ycountbs + ${1:ModelName}::model()->countBySql(${2:sql},array('${3:key}'=>${4:value})); + +#Yii Model updateAll +snippet yupdatea + ${1:ModelName}::model()->updateAll(${2:array('attributes')}, ${3:condition},array('${4:key}'=>${5:value})); + +#Yii Model updateByPk +snippet yupdatebp + ${1:ModelName}::model()->updateByPk(${2:pk}, ${3:array('attributes')}, ${4:condition},array('${5:key}'=>${6:value})); + +#Yii Model deleteAll +snippet ydela + ${1:ModelName}::model()->deleteAll(${2:condition},array('${3:key}'=>${4:value})); + +#Yii Model deleteByPk +snippet ydelbp + ${1:ModelName}::model()->deleteByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${5:value})); + +#Yii Model find +snippet yfind + ${1:ModelName}::model()->find(${2:condition},array('${3:key}'=>${4:value})); + +#Yii Model findAll +snippet yfinda + ${1:ModelName}::model()->findAll(${2:condition},array('${3:key}'=>${4:value})); + +#Yii Model findByPk +snippet yfindbp + ${1:ModelName}::model()->findByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${5:value})); + +#Yii Model findAllByPk +snippet yfindabp + ${1:ModelName}::model()->findAllByPk(${2:pk}, ${3:condition},array('${4:key}'=>${5:value})); + +#Yii Model findBySql +snippet yfindbs + ${1:ModelName}::model()->findBySql(${2:sql}, array('${3:key}'=>${4:value})); + +#Yii Model findAllByAttributes +snippet yfindaba + ${1:ModelName}::model()->findAllByAttributes(array('${2:attributeName}'=>${3:attributeValue}), ${4:condition}, array('${5:key}'=>${6:value})); + +#Yii Model exists +snippet yexists + ${1:ModelName}::model()->exists(${2:condition}, array('${3:key}'=>${4:value})); + +#Yii Create model class +snippet ymodel + 'path.to.FilterClass', + 'propertyName'=>'propertyValue', + ), + ); + } + + public function actions() + { + // return external action classes, e.g.: + return array( + 'action1'=>'path.to.ActionClass', + 'action2'=>array( + 'class'=>'path.to.AnotherActionClass', + 'propertyName'=>'propertyValue', + ), + ); + } + */ + } + +#Yii Create controller action method +snippet yact + public function action${1:Index}(${2:params}) + { + ${3} + } + + From e845b783d3b62b1c2cd8525b5317adaa7917d74a Mon Sep 17 00:00:00 2001 From: Tom Vincent Date: Sun, 25 Nov 2012 19:10:03 +0000 Subject: [PATCH 66/97] Add ledger snippet --- snippets/ledger.snippets | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 snippets/ledger.snippets diff --git a/snippets/ledger.snippets b/snippets/ledger.snippets new file mode 100644 index 0000000..293d4b6 --- /dev/null +++ b/snippets/ledger.snippets @@ -0,0 +1,5 @@ +# Ledger +snippet ent + `strftime("%Y/%m/%d")` ${1:transaction} + ${2:account} ${3:value} + ${4:account} From ad850f303bb1d50ed8520a7b6b47e452e641c180 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Thu, 3 May 2012 00:12:10 +0200 Subject: [PATCH 67/97] add guard to the . python implementation --- snippets/python.snippets | 1 + 1 file changed, 1 insertion(+) diff --git a/snippets/python.snippets b/snippets/python.snippets index 7f58d98..3a88b08 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -76,6 +76,7 @@ snippet cascii snippet ld ${1:var} = lambda ${2:vars} : ${3:action} snippet . +guard left =~ '^\s*$' self. snippet try Try/Except try: From 0522e91741f84a9a61e2af65e24c30d8004799ae Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Thu, 29 Nov 2012 11:33:15 +0100 Subject: [PATCH 68/97] reference neosnippet --- README.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f1f8bac..17f1486 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,21 @@ Snipmate Snippets ================= -This repository contains snippets files for various programming languages for -the famous [snipMate][1] plugin for vim. This repository is -community-maintained and many people have contributed snippet files and other -improvements already. +This repository contains snippets files for various programming languages. + +It was originally written for the the famous [snipMate][1] plugin for vim. +However it appears that [Shougo's neosnippet][5] has a compatible mode allowing +to reuse most snippets. + +It is community-maintained and many people have contributed snippet files and other +improvements already. Not sure whether it implements all features such as +guards - does anybody know? [vim-snipmate][1] was originally started by [Michael Sanders][2] who has now unfortunately abandoned the project. [Rok Garbas][3] is now maintaining a [fork][4] of the project in hopes of improving the existing code base. + Language maintainers -------------------- @@ -27,7 +33,8 @@ Contributing notes ------------------ Until further work is done on `vim-snipmate`, please don't add folding markers -into snippets. +into snippets. `vim-snipmate` has some comments about how to patch all snippets +on the fly adding those. Authors ------- @@ -45,3 +52,4 @@ terms of the MIT license. [2]: http://github.com/msanders [3]: http://github.com/garbas [4]: http://github.com/garbas/vim-snipmate +[5]: https://github.com/Shougo/neosnippet From b68e7544b6775a347b16037925f103cf86c2dd3d Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Sun, 2 Dec 2012 10:00:34 +0100 Subject: [PATCH 69/97] referencing issue asking for a merge with UltiSnips --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 17f1486..90c682b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +IMPORTANT: comment on: [What about merging whith Ultisnip using its engine](https://github.com/garbas/vim-snipmate/issues/114) + Snipmate Snippets ================= From ffcf23092b9d21de174f523687d43e3f6dc3b8c1 Mon Sep 17 00:00:00 2001 From: Darrell Hamilton Date: Sun, 2 Dec 2012 15:13:11 -0800 Subject: [PATCH 70/97] Use Filename() for interface and class name default values --- snippets/php.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/php.snippets b/snippets/php.snippets index 9ce93d4..47accd8 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -195,7 +195,7 @@ snippet interface * @package ${3:default} * @author ${4:`g:snips_author`} */ - interface ${1:} + interface ${1:`Filename()`} { ${5} } @@ -204,7 +204,7 @@ snippet class /** * ${1} */ - class ${2:ClassName} + class ${2:`Filename()`} { ${3} /** From 8cc31cd9d0f38ccc7b2197740e1143b68124b475 Mon Sep 17 00:00:00 2001 From: Darrell Hamilton Date: Sun, 2 Dec 2012 15:14:30 -0800 Subject: [PATCH 71/97] Improved getset snippet - Reuse getter @return type for type hinting in the setter - Separate property and method names to compensate for case differences --- snippets/php.snippets | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/snippets/php.snippets b/snippets/php.snippets index 9ce93d4..7d569cb 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -326,9 +326,9 @@ snippet getset /** * Gets the value of ${1:} * - * @return ${2} + * @return ${2:type} */ - public function get$1() + public function get${3:}() { return $this->$1; } @@ -336,9 +336,11 @@ snippet getset /** * Sets the value of $1 * - * @param mixed $$1 ${3} + * @param $2 $$1 ${4} + * + * @return ${5:`Filename()`} */ - public function set$1($$1) + public function set$3(${6:$2} $$1) { $this->$1 = $$1; return $this; From 373516590e69646a4c3190502c960119da70d0bc Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Mon, 3 Dec 2012 09:39:21 +0100 Subject: [PATCH 72/97] Revert "add guard to the . python implementation" reason: causes syntax problems to some people, and there may be bigger changes due to evaluating merging with ultisnips anyway. This reverts commit ad850f303bb1d50ed8520a7b6b47e452e641c180. --- snippets/python.snippets | 1 - 1 file changed, 1 deletion(-) diff --git a/snippets/python.snippets b/snippets/python.snippets index 3a88b08..7f58d98 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -76,7 +76,6 @@ snippet cascii snippet ld ${1:var} = lambda ${2:vars} : ${3:action} snippet . -guard left =~ '^\s*$' self. snippet try Try/Except try: From 12f2641e9d0acdf77ea07e352093feb8ff335d34 Mon Sep 17 00:00:00 2001 From: chrisyue Date: Tue, 4 Dec 2012 00:18:40 +0800 Subject: [PATCH 73/97] make getter and setter even better --- snippets/php.snippets | 49 ++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/snippets/php.snippets b/snippets/php.snippets index 05005d5..dd529d9 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -39,23 +39,30 @@ snippet m ${7} } # setter method -# I think vim's functions will not be called at the snipMate's runtime -# but `compile` time -# so `tolower` here won't work -# but it would be wonderful if we could make the property and parameter to lower case snippet sm - ${1:public} function set${2:Foo}(${3:$2 }$${4:`tolower('$2')`}) + /** + * Sets the value of ${1:foo} + * + * @param ${2:$1} $$1 ${3:description} + * + * @return ${4:`Filename()`} + */ + ${5:public} function set${6:$2}(${7:$2 }$$1) { - $this->${5:$4} = $$4; - ${6} + $this->${8:$1} = $$1; return $this; - } + }${9} # getter method snippet gm - ${1:public} function get${2:Foo}() + /** + * Gets the value of ${1:foo} + * + * @return ${2:$1} + */ + ${3:public} function get${4:$2}() { - return $this->${3:$2}; - } + return $this->${5:$1}; + }${6} #setter snippet $s ${1:$foo}->set${2:Bar}(${3}); @@ -322,29 +329,29 @@ snippet http_redirect header ("Location: ".URL); exit(); # Getters & Setters -snippet getset +snippet gs /** - * Gets the value of ${1:} + * Gets the value of ${1:foo} * - * @return ${2:type} + * @return ${2:$1} */ - public function get${3:}() + public function get${3:$2}() { - return $this->$1; + return $this->${4:$1}; } /** * Sets the value of $1 * - * @param $2 $$1 ${4} + * @param $2 $$1 ${5:description} * - * @return ${5:`Filename()`} + * @return ${6:`Filename()`} */ - public function set$3(${6:$2} $$1) + public function set$3(${7:$2 }$$1) { - $this->$1 = $$1; + $this->$4 = $$1; return $this; - } + }${8} snippet rett return true; snippet retf From fe3b2d61ca0e9a611ef8986f97723160c9e657dc Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Fri, 7 Dec 2012 09:55:14 +0100 Subject: [PATCH 74/97] drop dependency snipmate, cause there are two engines which can use this pool of snippets now --- README.md | 15 +++++++++++++-- addon-info.json | 1 - 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 90c682b..f08b6f2 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,18 @@ Snipmate Snippets This repository contains snippets files for various programming languages. It was originally written for the the famous [snipMate][1] plugin for vim. -However it appears that [Shougo's neosnippet][5] has a compatible mode allowing -to reuse most snippets. +However today there are at least 3 plugins which can make use of this snippet repository: + +1) [snipMate][1] +2) [Shougo's neosnippet][5] has a compatible mode allowing + to reuse most snippets. +3) [ultisnip][6] (experimental, mind the branch snipmate-merge) + This code is subject to change. Take it as preview. That branch + has additional notes for Snipmate users. at the bottom. + In the long run ultisnip will have its own set of snippets, because it is + more powerful cause it supports nested snippets. + + It is community-maintained and many people have contributed snippet files and other improvements already. Not sure whether it implements all features such as @@ -55,3 +65,4 @@ terms of the MIT license. [3]: http://github.com/garbas [4]: http://github.com/garbas/vim-snipmate [5]: https://github.com/Shougo/neosnippet +[6]: https://github.com/MarcWeber/UltiSnips/tree/snipmate-merge diff --git a/addon-info.json b/addon-info.json index 1f37bed..303bf28 100644 --- a/addon-info.json +++ b/addon-info.json @@ -4,7 +4,6 @@ "maintainer" : "honza @ github & others", "repository" : {"type": "git", "url": "git://github.com/honza/snipmate-snippets.git"}, "dependencies" : { - "snipmate": {} }, "description" : "community driven set of snippets for snipmate" } From 1e6bafdca28ab4d335e28643b40951765f6bc9e6 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Fri, 7 Dec 2012 10:02:28 +0100 Subject: [PATCH 75/97] need nls? --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f08b6f2..a242eca 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,10 @@ It was originally written for the the famous [snipMate][1] plugin for vim. However today there are at least 3 plugins which can make use of this snippet repository: 1) [snipMate][1] + 2) [Shougo's neosnippet][5] has a compatible mode allowing to reuse most snippets. + 3) [ultisnip][6] (experimental, mind the branch snipmate-merge) This code is subject to change. Take it as preview. That branch has additional notes for Snipmate users. at the bottom. From fabf19a0e309cf67601e662ec2a7bf4b1d28fad9 Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Fri, 7 Dec 2012 09:11:55 -0500 Subject: [PATCH 76/97] Add code for getopt in C, python, and BASH --- snippets/c.snippets | 57 ++++++++++++++++++++++++++++++++++++++++ snippets/python.snippets | 17 ++++++++++++ snippets/sh.snippets | 40 ++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+) diff --git a/snippets/c.snippets b/snippets/c.snippets index 72ce3d0..c476de4 100644 --- a/snippets/c.snippets +++ b/snippets/c.snippets @@ -150,6 +150,63 @@ snippet pr # fprintf (again, this isn't as nice as TextMate's version, but it works) snippet fpr fprintf(${1:stderr}, "${2:%s}\n"${3});${4} +# getopt +snippet getopt + int choice; + while (1) + { + static struct option long_options[] = + { + /* Use flags like so: + {"verbose", no_argument, &verbose_flag, 'V'}*/ + /* Argument styles: no_argument, required_argument, optional_argument */ + {"version", no_argument, 0, 'v'}, + {"help", no_argument, 0, 'h'}, + ${1} + {0,0,0,0} + }; + + int option_index = 0; + + /* Argument parameters: + no_argument: " " + required_argument: ":" + optional_argument: "::" */ + + choice = getopt_long( argc, argv, "vh", + long_options, &option_index); + + if (choice == -1) + break; + + switch( choice ) + { + case 'v': + ${2} + break; + + case 'h': + ${3} + break; + + case '?': + /* getopt_long will have already printed an error */ + break; + + default: + /* Not sure how to get here... */ + return EXIT_FAILURE; + } + } + + /* Deal with non-option arguments here */ + if ( optind < argc ) + { + while ( optind < argc ) + { + ${4} + } + } ## ## Miscellaneous # This is kind of convenient diff --git a/snippets/python.snippets b/snippets/python.snippets index 7f58d98..dd2e812 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -139,3 +139,20 @@ snippet testcase ${3:# TODO: write code...} snippet fut from __future__ import ${1} +#getopt +snippet getopt + try: + # Short option syntax: "hv:" + # Long option syntax: "help" or "verbose=" + opts, args = getopt.getopt(sys.argv[1:], "${1:short_options}", [${2:long_options}]) + + except getopt.GetoptError, err: + # Print debug info + print str(err) + ${3:error_action} + + for option, argument in opts: + if option in ("-h", "--help"): + ${4} + elif option in ("-v", "--verbose"): + verbose = argument diff --git a/snippets/sh.snippets b/snippets/sh.snippets index 508056c..9a48eb5 100644 --- a/snippets/sh.snippets +++ b/snippets/sh.snippets @@ -41,3 +41,43 @@ snippet go # Set SCRIPT_DIR variable to directory script is located. snippet sdir SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# getopt +snippet getopt + __ScriptVersion="${1:version}" + + #=== FUNCTION ================================================================ + # NAME: usage + # DESCRIPTION: Display usage information. + #=============================================================================== + function usage () + { + cat <<- EOT + + Usage : $${0:0} [options] [--] + + Options: + -h|help Display this message + -v|version Display script version + + EOT + } # ---------- end of function usage ---------- + + #----------------------------------------------------------------------- + # Handle command line arguments + #----------------------------------------------------------------------- + + while getopts ":hv" opt + do + case $opt in + + h|help ) usage; exit 0 ;; + + v|version ) echo "$${0:0} -- Version $__ScriptVersion"; exit 0 ;; + + \? ) echo -e "\n Option does not exist : $OPTARG\n" + usage; exit 1 ;; + + esac # --- end of case --- + done + shift $(($OPTIND-1)) + From 16b958ccd398f015151bdcb0624f77deacfc6748 Mon Sep 17 00:00:00 2001 From: chrisyue Date: Thu, 20 Dec 2012 15:57:51 +0800 Subject: [PATCH 77/97] add anotation, get and set snippet, good for doctrine --- snippets/php.snippets | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/snippets/php.snippets b/snippets/php.snippets index dd529d9..09b9152 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -352,6 +352,26 @@ snippet gs $this->$4 = $$1; return $this; }${8} +# anotation, get, and set, useful for doctrine +snippet ags + /** + * ${1:description} + * + * @ORM\Column(type="{7:string}") + */ + ${2:protected} $${3:foo}; + + public function get${4:$3}() + { + return $this->$3; + } + + public function set$4(${5:$4 }$${6:$3}) + { + $this->$3 = $$6; + + return $this; + } snippet rett return true; snippet retf From 3a6142acfda6c8604ebe13d4f795b7be0260ecaa Mon Sep 17 00:00:00 2001 From: chrisyue Date: Thu, 20 Dec 2012 16:04:11 +0800 Subject: [PATCH 78/97] fix a typo --- snippets/php.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/php.snippets b/snippets/php.snippets index 09b9152..17efaae 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -357,7 +357,7 @@ snippet ags /** * ${1:description} * - * @ORM\Column(type="{7:string}") + * @ORM\Column(type=$7) */ ${2:protected} $${3:foo}; From 4fff4b48e095a455604c96a682cff9bc99f4f861 Mon Sep 17 00:00:00 2001 From: Nan Cloudio Jiang Date: Fri, 21 Dec 2012 20:04:19 -0500 Subject: [PATCH 79/97] R.snippets. Add snippets for frequently used plot and statistical test functions --- snippets/r.snippets | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/snippets/r.snippets b/snippets/r.snippets index 909e70d..71186e3 100644 --- a/snippets/r.snippets +++ b/snippets/r.snippets @@ -93,3 +93,29 @@ snippet ma maply(${1:matrix}, ${2:function}) snippet m_ m_ply(${1:matrix}, ${2:function}) + +# plot functions +snippet pl + plot(${1:x}, ${2:y}) +snippet ggp + ggplot(${1:data}, aes(${2:aesthetics})) +snippet img + ${1:(jpeg,bmp,png,tiff)}(filename="${2:filename}", width=${3}, height=${4}, unit="${5}") + ${6:plot} + dev.off() + +# statistical test functions +snippet fis + fisher.test(${1:x}, ${2:y}) +snippet chi + chisq.test(${1:x}, ${2:y}) +snippet tt + t.test(${1:x}, ${2:y}) +snippet wil + wilcox.test(${1:x}, ${2:y}) +snippet cor + cor.test(${1:x}, ${2:y}) +snippet fte + var.test(${1:x}, ${2:y}) +snippet kvt + kv.test(${1:x}, ${2:y}) From ea806b1e9e98a0faf2323f528603cedda57d529c Mon Sep 17 00:00:00 2001 From: chrisyue Date: Fri, 11 Jan 2013 11:37:02 +0800 Subject: [PATCH 80/97] fix typo --- snippets/php.snippets | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/snippets/php.snippets b/snippets/php.snippets index 17efaae..e861a5b 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -357,7 +357,7 @@ snippet ags /** * ${1:description} * - * @ORM\Column(type=$7) + * @${7} */ ${2:protected} $${3:foo}; @@ -369,7 +369,6 @@ snippet ags public function set$4(${5:$4 }$${6:$3}) { $this->$3 = $$6; - return $this; } snippet rett From 64455cdf0490edbca0cb5e87ed3c0414647df020 Mon Sep 17 00:00:00 2001 From: "Allen.M" Date: Thu, 17 Jan 2013 16:27:13 +0800 Subject: [PATCH 81/97] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20javascript=5Fjquery.?= =?UTF-8?q?snippets=20=E8=BD=AF=E8=BF=9E=E6=8E=A5=E5=88=B0=20javascript-jq?= =?UTF-8?q?uery.snippets=20=E7=94=A8=E6=9D=A5=E6=94=AF=E6=8C=81=20neosnipp?= =?UTF-8?q?et?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snippets/javascript_jquery.snippets | 1 + 1 file changed, 1 insertion(+) create mode 120000 snippets/javascript_jquery.snippets diff --git a/snippets/javascript_jquery.snippets b/snippets/javascript_jquery.snippets new file mode 120000 index 0000000..9b4966d --- /dev/null +++ b/snippets/javascript_jquery.snippets @@ -0,0 +1 @@ +javascript-jquery.snippets \ No newline at end of file From c3ae804a82912e318f6c20281bd9b68c84a6bf63 Mon Sep 17 00:00:00 2001 From: Oliver Andrich Date: Sun, 27 Jan 2013 20:13:33 +0100 Subject: [PATCH 82/97] A more complete property snippet for python. This snippet is inspired by the snippet provided by Sublime Text. The current snippet in the upstream repository is missing at least two lines: return locals() $1 = property(**$1()) --- snippets/python.snippets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snippets/python.snippets b/snippets/python.snippets index dd2e812..508a51b 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -51,6 +51,10 @@ snippet property ${3:return self._$1} def fset(self, value): ${4:self._$1 = value} + def fdel(self): + ${5:del self._$1} + return locals() + $1 = property(**$1()) # Ifs snippet if if ${1:condition}: From 2773a13c332035b2612616389c195c095e645243 Mon Sep 17 00:00:00 2001 From: Oliver Andrich Date: Sun, 27 Jan 2013 20:55:13 +0100 Subject: [PATCH 83/97] Added elif snippet to htmldjango. --- snippets/htmldjango.snippets | 3 +++ 1 file changed, 3 insertions(+) diff --git a/snippets/htmldjango.snippets b/snippets/htmldjango.snippets index 38f836b..c19e877 100644 --- a/snippets/htmldjango.snippets +++ b/snippets/htmldjango.snippets @@ -50,6 +50,9 @@ snippet if snippet else {% else %} ${1} +snippet elif + {% elif ${1} %} + ${2} snippet ifchanged {% ifchanged %}${1}{% endifchanged %} snippet ifequal From 664c3dd6840c26c8469a36f4e4db933fe4db0e6c Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Mon, 28 Jan 2013 19:36:36 -0500 Subject: [PATCH 84/97] Fixing numbering in html snippets. --- snippets/html.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/html.snippets b/snippets/html.snippets index 0f75efd..d547f1a 100644 --- a/snippets/html.snippets +++ b/snippets/html.snippets @@ -556,7 +556,7 @@ snippet link snippet link:atom ${2} snippet link:css - ${4} + ${3} snippet link:favicon ${2} snippet link:rss From 576063eb676d8c75e35f37971ca9affc821121bf Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Tue, 5 Feb 2013 10:02:29 -0300 Subject: [PATCH 85/97] Add more rspec snippets. --- snippets/ruby.snippets | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 0500aaa..a93b239 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -910,6 +910,8 @@ snippet it snippet itp it "${1:spec_name}" ${2} +snippet its + its(:${1:method}) { should ${2} } snippet desc describe ${1:class_name} do ${2} @@ -926,3 +928,9 @@ snippet aft after :${1:each} do ${2} end +snippet let + let(:${1:method}) { ${2} } +snippet subj + subject { ${1} } +snippet spec + specify { subject.${1} } From d2337af7bbd954bf09ea85a545d6b86d85a0e955 Mon Sep 17 00:00:00 2001 From: Oliver Andrich Date: Tue, 5 Feb 2013 21:57:41 +0100 Subject: [PATCH 86/97] =?UTF-8?q?Fixed=20the=20{%=20with=20%}=C2=A0templat?= =?UTF-8?q?e=20tag=20from=20htmldjango.snippets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snippets/htmldjango.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/htmldjango.snippets b/snippets/htmldjango.snippets index c19e877..09cf98e 100644 --- a/snippets/htmldjango.snippets +++ b/snippets/htmldjango.snippets @@ -83,6 +83,8 @@ snippet widthratio {% widthratio ${1:this_value} ${2:max_value} ${3:100} %} snippet with {% with ${1} as ${2} %} + ${3} + {% endwith %} # Template Filters From cd8f5e19c48ee94ff0a44163aea9073927445cda Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Thu, 7 Feb 2013 12:56:54 +0100 Subject: [PATCH 87/97] document renaming of branch --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a242eca..c1cc3a6 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ However today there are at least 3 plugins which can make use of this snippet re 2) [Shougo's neosnippet][5] has a compatible mode allowing to reuse most snippets. -3) [ultisnip][6] (experimental, mind the branch snipmate-merge) +3) [ultisnip][6] (stable enough to be used, branch master previously snipmate-merge) This code is subject to change. Take it as preview. That branch has additional notes for Snipmate users. at the bottom. In the long run ultisnip will have its own set of snippets, because it is From 4036a5339ba9c13a19fb98576de06f65e6e03273 Mon Sep 17 00:00:00 2001 From: Andreas Krennmair Date: Fri, 8 Feb 2013 20:21:40 +0100 Subject: [PATCH 88/97] go: type os.Error became built-in type error after go r60. --- snippets/go.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/go.snippets b/snippets/go.snippets index 0e4fe61..372fb57 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -126,12 +126,12 @@ snippet fr } # function simple snippet fun - func ${1:funcName}(${2}) ${3:os.Error} { + func ${1:funcName}(${2}) ${3:error} { ${4:/* code */} } # function on receiver snippet fum - func (self ${1:type}) ${2:funcName}(${3}) ${4:os.Error} { + func (self ${1:type}) ${2:funcName}(${3}) ${4:error} { ${5:/* code */} } # make From dfcb7ce519d11d1d46c943dcf17f1d169c7ce088 Mon Sep 17 00:00:00 2001 From: Fatih Arslan Date: Tue, 12 Feb 2013 01:12:58 -0800 Subject: [PATCH 89/97] Fix go functions --- snippets/go.snippets | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/snippets/go.snippets b/snippets/go.snippets index 372fb57..e737da6 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -67,7 +67,7 @@ snippet i snippet im import ( "${1:package}" - ) + )${2} # interface snippet in interface{} @@ -80,12 +80,12 @@ snippet inf snippet if if ${1:/* condition */} { ${2:/* code */} - } + }${2} # else snippet snippet el else { ${1} - } + }${2} # error snippet snippet ir if err != nil { @@ -114,21 +114,25 @@ snippet ie } else { ${3} } + ${4} # for loop snippet fo for ${2:i} = 0; $2 < ${1:count}; $2${3:++} { ${4:/* code */} } + ${5} # for range loop snippet fr for ${1:k}, ${2:v} := range ${3} { ${4:/* code */} } + ${5} # function simple snippet fun func ${1:funcName}(${2}) ${3:error} { ${4:/* code */} } + ${5} # function on receiver snippet fum func (self ${1:type}) ${2:funcName}(${3}) ${4:error} { @@ -145,6 +149,7 @@ snippet main func main() { ${1:/* code */} } + ${2} # new snippet nw new(${1:type}) @@ -180,7 +185,8 @@ snippet sr snippet st struct ${1:name} { ${2:/* data */} - }${4} + } + ${3} # switch snippet sw switch ${1:var} { From 4c6cc10d54c474d9f3830ef54851400804a3d619 Mon Sep 17 00:00:00 2001 From: Fatih Arslan Date: Tue, 12 Feb 2013 01:23:36 -0800 Subject: [PATCH 90/97] Add log.Printf and Println to go snippets with fixes --- snippets/go.snippets | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/snippets/go.snippets b/snippets/go.snippets index e737da6..d02aa8f 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -138,6 +138,13 @@ snippet fum func (self ${1:type}) ${2:funcName}(${3}) ${4:error} { ${5:/* code */} } + ${6} +# log printf +snippet lf + log.Printf("%${1:s}", ${2:var})${3} +# log printf +snippet lp + log.Println("${1}")${2} # make snippet mk make(${1:[]string}, ${2:0}) @@ -158,7 +165,7 @@ snippet pn panic("${1:msg}") # print snippet pr - fmt.Printf("${1:%s}\n", ${2:var})${3} + fmt.Printf("%${1:s}\n", ${2:var})${3} # range snippet rn range ${1} @@ -198,7 +205,7 @@ snippet sw ${6:/* code */} } snippet sp - fmt.Sprintf("${1:%s}", ${2:var})${3} + fmt.Sprintf("%${1:s}", ${2:var})${3} # true snippet t true From 74e132730243d93e3c07434f0e063898e8571463 Mon Sep 17 00:00:00 2001 From: indi <1334@shadowproject.net> Date: Wed, 13 Feb 2013 19:54:08 +0100 Subject: [PATCH 91/97] fixed quotes in time tag snippet --- snippets/html.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/html.snippets b/snippets/html.snippets index d547f1a..cfc44ad 100644 --- a/snippets/html.snippets +++ b/snippets/html.snippets @@ -789,7 +789,7 @@ snippet thead ${1} snippet time - snippet title ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} snippet tr From 6c4c7f51d79f5c3fde6153dfdad25461981ad8eb Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Mon, 18 Feb 2013 10:09:55 -0300 Subject: [PATCH 92/97] Add snippets to rspec shared examples and new rspec syntax. --- snippets/ruby.snippets | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index a93b239..2647d62 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -934,3 +934,13 @@ snippet subj subject { ${1} } snippet spec specify { subject.${1} } +snippet exp + expect(${1:object}).to ${2} +snippet bt + be_true +snippet bf + be_false +snippet shared + shared_examples "${1:shared examples name}" ${2} +snippet itb + it_behaves_like "${1:shared examples name}"${2} From 3ef38996f4582a709ca3f8110f2fb53d6e96581e Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Mon, 18 Feb 2013 10:25:25 -0300 Subject: [PATCH 93/97] Import scala snippets created by @gorodok with some alterations. --- snippets/scala.snippets | 349 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 349 insertions(+) create mode 100644 snippets/scala.snippets diff --git a/snippets/scala.snippets b/snippets/scala.snippets new file mode 100644 index 0000000..c342228 --- /dev/null +++ b/snippets/scala.snippets @@ -0,0 +1,349 @@ +################################################################ +# © Copyright 2011 Konstantin Gorodinskiy. All Rights Reserved.# +# Do What The Fuck You Want To Public License, Version 2. # +# See http://sam.zoy.org/wtfpl/COPYING for more details. # +################################################################ +# Scala lang +#if +snippet if + if(${1:obj}) { + ${2:/* code */} + } +#if not +snippet ifn + if(!${1:obj}) { + ${2:/* code */} + } +#if-else +snippet ifel + if(${1:obj}) { + ${2:/* code */} + } else { + ${3:/* code */} + } +#if-else-if +snippet ifelif + if(${1:obj}) { + ${2:/* code */} + } else if(${3:obj}) { + ${4:/* code */} + } +#while loop +snippet while + while (${1:obj}) { + ${2:/* code */} + } +#for loop(classic) +snippet for + for (${1:item} <- ${2:obj}) { + ${3:/* code */} + } +#for loop(indexed) +snippet fori + for (${1:i} <- ${2:0} to ${3:obj}.length) { + ${4:/* code */} + } +#exceptions +snippet try + try { + ${1:/* code */} + } catch { + case e: FileNotFoundException => ${2:/* code */} + case e: IOException => ${3:/* code */} + } finally { + ${4:/* code */} + } +#match +snippet match + ${1: obj} match { + case ${2:e} => ${3:/* code */} + case _ => ${4:/* code */} + } +#case +snippet case + case ${1:value} => ${2:/* code */} +############################ +# methods and arguments +# +#arg +snippet arg + ${1:a}: ${2:T}${3:, arg} +#args +snippet args + ${1:args}: ${2:T}* +#def +snippet def + def ${1:name}(${2:arg}) = ${3:} +#private def +snippet prdef + private def ${1:name}(${2:arg}) = ${3:} +#override def +snippet ovdef + override def ${1:name}(${2:arg}) = ${3:} +#first class function(see scalabook p 188) +snippet fcf + (${1:a}: ${2:T}) => $1 ${3:/* code */} +snippet => + ${1:name} => ${2:/* code */} +#recursion +snippet rec + def ${1:name}(${2:arg}) = + if($2) $2 + else $1($2) +#curried method +snippet crdef + def ${1:name}(${2:arg})(${3:arg}) = ${4:} +#main method +#check validity of T +snippet main + def main(args: Array[String]):${1:T} = ${2:} +############################ +# basic types(general purpose) +# you might want to use basic types snippets + +#1 +snippet T Double + dbl +#2 +snippet T Int + int +#3 +snippet T Long + lng +#4 +snippet T Char + chr +#5 +snippet T String + str +#6 +snippet T Array + arr +#7 +snippet T Buffer + buf +#8 +snippet T List + list +#9 +snippet T Tuple + tpl +#10 +snippet T Set + set +#11 +snippet T Map + map +#12 +snippet T HashSet + hset +#13 +snippet T HashMap + hmap +#14 +snippet T Boolean + bool +#end + +#named snippets for types +snippet bool + Boolean +snippet anyr + AnyRef +snippet dbl + Double +snippet int + Int +snippet str + String +snippet chr + Char +snippet lng + Long +snippet arr + Array${1:[T]}${2:()} +snippet buf + Buffer${1:[T]}${2:()} +snippet list + List${1:[T]}${2:()} +snippet tpl + Tuple${1:2}[${2:T},${3:T}] +snippet set + Set${1:[T]}${2:()} +snippet hset + HashSet${1:[T]}${2:()} +snippet mhset + mutable.HashSet${1:[T]}${2:()} +#for maps +snippet keyval + ${1:key}->${2:val}${3:, keyval} +snippet map + Map[${1:T},${2:T}]${3:(keyval)} +snippet hmap + HashMap[${1:T},${2:T}]${3:(keyval)} +snippet mmap + mutable.Map[${1:T},${2:T}]${3:(keyval)} +snippet mhmap + mutable.HashMap[${1:T},${2:T}]${3:(keyval)} +#TODO add TreeMap and TreeSet +#asInstanceOf[] +snippet as + ${1:name}.asInstanceOf[${2:T}] +#isInstanceOf[] + ${1:name}.isInstanceOf[${2:T}] +#end +#collections methods + +#scope() with one arg +snippet (a + (${1:a} => ${2:/* code */}) +#scope() with two args +snippet {( + {(${1:a},${2:b}) => + ${3:/* code */} + } +#filter +snippet filter + ${1:name}.filter (a +#map function +snippet mapf + ${1:name}.map (a +#flatmap +snippet flatmap + ${1:name}.flatMap${2:[T]}(a +#fold left +snippet fldl + ${1:name}.foldLeft(${2:first}) {( +#fold right +snippet fldr + ${1:name}.foldRight(${2:first}) {( +#fold left operator(if u wanna reduce readability of ur code) +#use wildcard symbols +snippet /: + (${1:first}/:${2:name})(${3:/* code */}) +#fold right operator +snippet :\ + (${1:first}:\${2:name})(${3:/* code */}) +#reduce left +snippet redl + ${1:name}.reduceLeft[${2:T}] {( +#reduce right +snippet redr + ${1:name}.reduceRight[${2:T}] {( +#zipWithIndex(safe way). +#see http://daily-scala.blogspot.com/2010/05/zipwithindex.html +snippet zipwi + ${1:name}.view.zipWithIndex +#split +snippet spl + ${1:name}.split("${2:,}") +#end +snippet val + val ${1:name}${2:: T} = ${3:value} +snippet var + var ${1:name}${2:: T} = ${3:value} +############################ +# classes +# +#extends +snippet extends + extends ${1:what} +#with +snippet with + with ${1:what}${2: with} +#auxiliary constructor(a. this) +snippet athis + def this(arg) = this(arg) +#abstract class +snippet abstract + abstract class ${1:name}${2:(arg)}${3: extends }${4: with} { + ${5:override def toString = "$1"} + ${6:/* code */} + } +#class +snippet class + class ${1:name}${2:(arg)}${3: extends }${4: with} { + ${5:override def toString = "$1"} + ${6:/* code */} + } +#object +snippet object + object ${1:name}${2:(arg)}${3: extends }${4: with} ${5:} +#trait +snippet trait + trait ${1:name}${2: extends }${3: with} { + ${4:} + } +#class with trait Ordered(page 265) +snippet ordered + class ${1:name}${2:(arg)} extends Ordered[$1] ${3: with} { + ${4:override def toString = "$1"} + def compare(that: $1) = ${5:this - that} + ${6:/* code */} + } +#case class +snippet casecl + case class ${1:name}${2:(arg)}${3: extends }${4: with} ${5:} +############################ +# testing +# +#scalatest imports +snippet scalatest + ${1:import org.scalatest.Suite} + ${2:import org.scalatest.FunSuite} +#assert +snippet assert + assert(${1:a}==${2:b}) +#ensuring(p 296) +snippet ensuring + ifel ensuring(${1:a}==${2:b}) +#expect +snippet expect + expect(${1:what}) { +#intercept +snippet intercept + intercept[${1:IllegalArgumentException}] { +#test +snippet test + test("${1:description}") { +#suite +snippet suite + class ${1:name} extends Suite { + def test() { + } +#funsuite +snippet fsuite + class ${1:name} extends FunSuite { + test("${2:description}") { + } +############################ +# SBT +# +snippet webproject + import sbt._ + + class ${1:Name}(info: ProjectInfo) extends DefaultWebProject(info) { + val liftVersion = "${2:2.3}" + + override def libraryDependencies = Set( + + ) ++ super.libraryDependencies + + val snapshots = ScalaToolsSnapshots + } +#depencies +snippet liftjar + "net.liftweb" %% "${1:lib}" % liftVersion % "compile->default", +snippet jettyjar + "org.mortbay.jetty" % "jetty" % "${1:version}" % "test->default", +############################ +# Lift +# +#lift imports +snippet liftimports + import _root_.net.liftweb.http._ + import S._ + import _root_.net.liftweb.util._ + import Helpers._ + import _root_.scala.xml._ +#TODO LIFT,SBT,WEB.XML,HTML snippets From 6e58f722f3770777b8303bc284ad5c0d88bc096c Mon Sep 17 00:00:00 2001 From: Eustaquio Rangel Date: Mon, 25 Feb 2013 09:07:04 -0300 Subject: [PATCH 94/97] Fixed Ruby rSpec be_true and be_false --- snippets/ruby.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 2647d62..0365ec2 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -936,9 +936,9 @@ snippet spec specify { subject.${1} } snippet exp expect(${1:object}).to ${2} -snippet bt +snippet btr be_true -snippet bf +snippet bfa be_false snippet shared shared_examples "${1:shared examples name}" ${2} From 63551117aac15a93e7b32b31b096484b0ed59cf2 Mon Sep 17 00:00:00 2001 From: Mike Foley Date: Tue, 26 Feb 2013 15:51:09 -0800 Subject: [PATCH 95/97] added each_with_object Ruby snippets --- snippets/ruby.snippets | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 0365ec2..879677c 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -289,6 +289,12 @@ snippet eawid each_with_index do |${1:e},${2:i}| ${3} end +snippet eawo + each_with_object(${1:init}) { |${2:e}, ${3:var}| ${4} } +snippet eawod + each_with_object(${1:init}) do |${2:e}, ${3:var}| + ${4} + end snippet reve reverse_each { |${1:e}| ${2} } snippet reved From 0ccc49e39d813829d5b5d84d237bbed05e620024 Mon Sep 17 00:00:00 2001 From: Mike Foley Date: Tue, 26 Feb 2013 15:51:33 -0800 Subject: [PATCH 96/97] added a space to each_with_index Ruby snippet, to be consistent with similar snippets --- snippets/ruby.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 879677c..8805430 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -286,7 +286,7 @@ snippet eavd snippet eawi each_with_index { |${1:e}, ${2:i}| ${3} } snippet eawid - each_with_index do |${1:e},${2:i}| + each_with_index do |${1:e}, ${2:i}| ${3} end snippet eawo From 0fbb89d9086ef3b831d8d6f3b238ad19893f543a Mon Sep 17 00:00:00 2001 From: Mike Foley Date: Fri, 1 Mar 2013 14:48:50 -0800 Subject: [PATCH 97/97] added delegate to ruby.snippets --- snippets/ruby.snippets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 8805430..ccb3968 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -660,6 +660,10 @@ snippet defupdate end end end${3} +snippet dele delegate .. to + delegate :${1:methods}, :to => :${2:object} +snippet dele delegate .. to .. prefix .. allow_nil + delegate :${1:methods}, :to => :${2:object}, :prefix => :${3:prefix}, :allow_nil => ${4:allow_nil} snippet flash flash[:${1:notice}] = "${2}" snippet habtm