From 0b8a04fee06804889233cc7672ffbb2f08b868c8 Mon Sep 17 00:00:00 2001 From: David Barnett Date: Mon, 14 Apr 2014 20:57:59 -0700 Subject: [PATCH 01/14] Add snippets for soy filetype (a.k.a. closure templates) --- UltiSnips/soy.snippets | 61 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 UltiSnips/soy.snippets diff --git a/UltiSnips/soy.snippets b/UltiSnips/soy.snippets new file mode 100644 index 0000000..579e1fe --- /dev/null +++ b/UltiSnips/soy.snippets @@ -0,0 +1,61 @@ +extends html + +snippet ns "Namespace" b +{namespace ${1:name}} +endsnippet + +snippet tmpl "Template" b +/** + * ${2:TODO(`whoami`): Describe this template.} + */ +{template .${1:name}} + $0 +{/template} +endsnippet + +snippet msg "Message" b +{msg desc="${1:description}"} + $0 +{/msg} +endsnippet + +snippet let "let command" b +{let $${1:identifier}: ${2:expression} /} +endsnippet + +snippet if "if .. (if)" b +{if ${1:expression}} + $0 +{/if} +endsnippet + +snippet ife "if .. else (ife)" b +{if ${1:expression}} + $2 +{else} + $0 +{/if} +endsnippet + +snippet eli "else if .. (eli)" b +{elif ${1:expression}} + $0 +endsnippet + +snippet fore "foreach command" b +{foreach $${1:var} in ${2:ref}} + $0 +{/foreach} +endsnippet + +snippet for "for command" b +{for $${1:var} in range(${2:rangeexpr})} + $0 +{/for} +endsnippet + +snippet call "template call" b +{call ${1:tmpl}} + $0 +{/call} +endsnippet From f770dab87dd0edf82f7a6d44152bdb44377ce5dc Mon Sep 17 00:00:00 2001 From: David Barnett Date: Wed, 16 Apr 2014 09:03:41 -0700 Subject: [PATCH 02/14] Add "priority -50" to UltiSnips/soy.snippets --- UltiSnips/soy.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/UltiSnips/soy.snippets b/UltiSnips/soy.snippets index 579e1fe..9a22a57 100644 --- a/UltiSnips/soy.snippets +++ b/UltiSnips/soy.snippets @@ -1,3 +1,5 @@ +priority -50 + extends html snippet ns "Namespace" b From dba38fc3824cb01a5858120eea8b668db1f0e885 Mon Sep 17 00:00:00 2001 From: "David C. Bishop" Date: Fri, 18 Apr 2014 18:02:36 +1000 Subject: [PATCH 03/14] Add 'priority -50' to rust.snippets. --- UltiSnips/rust.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/UltiSnips/rust.snippets b/UltiSnips/rust.snippets index 98a371f..71ea845 100644 --- a/UltiSnips/rust.snippets +++ b/UltiSnips/rust.snippets @@ -2,6 +2,8 @@ # Rust Snippets # ####################################################################### +priority -50 + ############### # Functions # ############### From 7af4b8f424e4783eb4cdb0b568eae90b75d34e5d Mon Sep 17 00:00:00 2001 From: "David C. Bishop" Date: Fri, 18 Apr 2014 18:04:17 +1000 Subject: [PATCH 04/14] Remove /* code */ placeholders in rust.snippets. --- UltiSnips/rust.snippets | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/UltiSnips/rust.snippets b/UltiSnips/rust.snippets index 71ea845..b4b03e2 100644 --- a/UltiSnips/rust.snippets +++ b/UltiSnips/rust.snippets @@ -9,14 +9,14 @@ priority -50 ############### snippet fn "A function, optionally with arguments and return type." fn ${1:function_name}(${2})${3/..*/ -> /}${3} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet snippet test "Test function" #[test] fn ${1:test_function_name}() { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet @@ -55,7 +55,7 @@ endsnippet snippet mod "A mod." b mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } /* $1 */ endsnippet @@ -97,7 +97,7 @@ endsnippet snippet if "if .. (if)" b if ${1:/* condition */} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet @@ -109,19 +109,19 @@ endsnippet snippet while "while .. {}" b while ${1:condition} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet snippet for "for .. in .." b for ${1:i} in ${2:range(0u, 10)} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet snippet spawn "spawn(proc() { .. });" b spawn(proc() { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} }); endsnippet @@ -146,13 +146,13 @@ endsnippet ############ snippet st "Struct" b struct ${1:`!p snip.rv = snip.basename.title() or "name"`} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet snippet stn "Struct with new constructor." b pub struct ${1:`!p snip.rv = snip.basename.title() or "name"`} { - ${3:/* code */} + ${3} } impl $1 { @@ -180,14 +180,14 @@ endsnippet ########## snippet imp "An impl" b impl ${1:Name} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet snippet drop "Drop implementation" b impl Drop for ${1:Name} { fn drop(&mut self) { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } } endsnippet @@ -198,7 +198,7 @@ endsnippet ############ snippet trait "Trait block" b trait ${1:Name} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet From 28fc19552f33f34421eea9b2861aa1e2eb339cb6 Mon Sep 17 00:00:00 2001 From: "David C. Bishop" Date: Fri, 18 Apr 2014 18:08:13 +1000 Subject: [PATCH 05/14] Add b option to rust snippets. --- UltiSnips/rust.snippets | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/UltiSnips/rust.snippets b/UltiSnips/rust.snippets index b4b03e2..9985226 100644 --- a/UltiSnips/rust.snippets +++ b/UltiSnips/rust.snippets @@ -7,26 +7,26 @@ priority -50 ############### # Functions # ############### -snippet fn "A function, optionally with arguments and return type." +snippet fn "A function, optionally with arguments and return type." b fn ${1:function_name}(${2})${3/..*/ -> /}${3} { ${VISUAL}${0} } endsnippet -snippet test "Test function" +snippet test "Test function" b #[test] fn ${1:test_function_name}() { ${VISUAL}${0} } endsnippet -snippet new "A new function" +snippet new "A new function" b pub fn new(${2}) -> ${1:Name} { ${VISUAL}${0}return $1 { ${3} }; } endsnippet -snippet main "The main function" +snippet main "The main function" b pub fn main() { ${VISUAL}${0} } @@ -34,7 +34,7 @@ endsnippet -snippet let "A let statement" +snippet let "A let statement" b let ${1:name}${3} = ${VISUAL}${2}; endsnippet From 7b5d7de5e9d7cbf092ca2cbb51065de0602efca6 Mon Sep 17 00:00:00 2001 From: "David C. Bishop" Date: Fri, 18 Apr 2014 18:10:50 +1000 Subject: [PATCH 06/14] Remove /* code */ placeholders from c, cpp and d. --- UltiSnips/c.snippets | 22 ++++++++--------- UltiSnips/cpp.snippets | 2 +- UltiSnips/d.snippets | 56 +++++++++++++++++++++--------------------- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/UltiSnips/c.snippets b/UltiSnips/c.snippets index 5b8eae8..21dd87b 100644 --- a/UltiSnips/c.snippets +++ b/UltiSnips/c.snippets @@ -16,7 +16,7 @@ endsnippet snippet #if "#if #endif" b #if ${1:0} -${VISUAL}${0:${VISUAL/(.*)/(?1::code)/}} +${VISUAL}${0} #endif endsnippet @@ -40,7 +40,7 @@ endsnippet snippet main "main() (main)" int main(int argc, char *argv[]) { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} return 0; } endsnippet @@ -48,14 +48,14 @@ endsnippet snippet for "for loop (for)" for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet snippet fori "for int loop (fori)" for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet @@ -86,13 +86,13 @@ endsnippet snippet wh "while loop" while(${1:/* condition */}) { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet snippet do "do...while loop (do)" do { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } while(${1:/* condition */}); endsnippet @@ -103,26 +103,26 @@ endsnippet snippet if "if .. (if)" if (${1:/* condition */}) { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet snippet el "else .. (else)" else { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet snippet eli "else if .. (eli)" else if (${1:/* condition */}) { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet snippet ife "if .. else (ife)" if (${1:/* condition */}) { - ${2:/* code */} + ${2} } else { @@ -144,7 +144,7 @@ endsnippet snippet fun "function" b ${1:void} ${2:function_name}(${3}) { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} } endsnippet diff --git a/UltiSnips/cpp.snippets b/UltiSnips/cpp.snippets index 3d79a64..c2cb3d0 100644 --- a/UltiSnips/cpp.snippets +++ b/UltiSnips/cpp.snippets @@ -27,7 +27,7 @@ endsnippet snippet ns "namespace .. (namespace)" namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`} { - ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} + ${VISUAL}${0} }${1/.+/ \/* /m}$1${1/.+/ *\/ /m} endsnippet diff --git a/UltiSnips/d.snippets b/UltiSnips/d.snippets index 99da292..264c9d5 100644 --- a/UltiSnips/d.snippets +++ b/UltiSnips/d.snippets @@ -106,14 +106,14 @@ endsnippet snippet if "if .. (if)" if(${1:/*condition*/}) { - ${VISUAL}${0:/*code*/} + ${VISUAL}${0} } endsnippet snippet ife "if .. else (ife)" b if(${1:/*condition*/}) { - ${2:/*code*/} + ${2} } else { @@ -124,14 +124,14 @@ endsnippet snippet el "else (el)" b else { - ${VISUAL}${1:/*code*/} + ${VISUAL}${1} } endsnippet snippet elif "else if (elif)" b else if(${1:/*condition*/}) { - ${VISUAL}${0:/*code*/} + ${VISUAL}${0} } endsnippet @@ -139,10 +139,10 @@ snippet sw "switch (sw)" switch(${1:/*var*/}) { case ${2:/*value*/}: - ${3:/*code*/} + ${3} break; case ${4:/*value*/}: - ${5:/*code*/} + ${5} break; ${7:/*more cases*/} default: @@ -154,10 +154,10 @@ snippet fsw "final switch (fsw)" switch(${1:/*var*/}) { case ${2:/*value*/}: - ${3:/*code*/} + ${3} break; case ${4:/*value*/}: - ${5:/*code*/} + ${5} break; ${7:/*more cases*/} } @@ -165,7 +165,7 @@ endsnippet snippet case "case (case)" b case ${1:/*value*/}: - ${2:/*code*/} + ${2} break; endsnippet @@ -178,42 +178,42 @@ endsnippet snippet do "do while (do)" b do { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } while(${1:/*condition*/}); endsnippet snippet wh "while (wh)" b while(${1:/*condition*/}) { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } endsnippet snippet for "for (for)" b for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { - ${VISUAL}${0:/*code*/} + ${VISUAL}${0} } endsnippet snippet forever "forever (forever)" b for(;;) { - ${VISUAL}${0:/*code*/} + ${VISUAL}${0} } endsnippet snippet fore "foreach (fore)" foreach(${1:/*elem*/}; ${2:/*range*/}) { - ${VISUAL}${3:/*code*/} + ${VISUAL}${3} } endsnippet snippet forif "foreach if (forif)" b foreach(${1:/*elem*/}; ${2:/*range*/}) if(${3:/*condition*/}) { - ${VISUAL}${4:/*code*/} + ${VISUAL}${4} } endsnippet @@ -249,21 +249,21 @@ endsnippet snippet fun "function definition (fun)" ${1:void} ${2:/*function name*/}(${3:/*args*/}) ${4:@safe pure nothrow} { - ${VISUAL}${5:/*code*/} + ${VISUAL}${5} } endsnippet snippet void "void function definition (void)" void ${1:/*function name*/}(${2:/*args*/}) ${3:@safe pure nothrow} { - ${VISUAL}${4:/*code*/} + ${VISUAL}${4} } endsnippet snippet this "ctor (this)" w this(${1:/*args*/}) { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } endsnippet @@ -295,7 +295,7 @@ endsnippet snippet scope "scope (scope)" b scope(${1:exit}) { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } endsnippet @@ -304,7 +304,7 @@ endsnippet snippet with "with (with)" with(${1}) { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } endsnippet @@ -405,14 +405,14 @@ endsnippet snippet version "version (version)" b version(${1:/*version name*/}) { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } endsnippet snippet debug "debug" b debug { - ${VISUAL}${1:/*code*/} + ${VISUAL}${1} } endsnippet @@ -422,7 +422,7 @@ endsnippet snippet temp "template (temp)" b template ${2:/*name*/}(${1:/*args*/}) { - ${3:/*code*/} + ${3} } endsnippet @@ -440,7 +440,7 @@ endsnippet snippet unittest "unittest (unittest)" b unittest { - ${1:/*code*/} + ${1} } endsnippet @@ -450,21 +450,21 @@ endsnippet snippet opDis "opDispatch (opDis)" b ${1:/*return type*/} opDispatch(string s)() { - ${2:/*code*/}; + ${2}; } endsnippet snippet op= "opAssign (op=)" b void opAssign(${1} rhs) ${2:@safe pure nothrow} { - ${2:/*code*/} + ${2} } endsnippet snippet opCmp "opCmp (opCmp)" b int opCmp(${1} rhs) @safe const pure nothrow { - ${2:/*code*/} + ${2} } endsnippet @@ -484,7 +484,7 @@ endsnippet snippet toString "toString (toString)" b string toString() @safe const pure nothrow { - ${1:/*code*/} + ${1} } endsnippet From ec973080f47fe038f076db97eeff44bc46d3e54b Mon Sep 17 00:00:00 2001 From: Ryan Pineo Date: Mon, 21 Apr 2014 14:07:28 -0400 Subject: [PATCH 07/14] Add angular snippets. Add two jasmine snippets for use with angular that prepoulate the "it" and "before" functions with "inject". Add an angular config snippet. --- UltiSnips/javascript_angular.snippets | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 UltiSnips/javascript_angular.snippets diff --git a/UltiSnips/javascript_angular.snippets b/UltiSnips/javascript_angular.snippets new file mode 100644 index 0000000..23b93e3 --- /dev/null +++ b/UltiSnips/javascript_angular.snippets @@ -0,0 +1,19 @@ +priority -50 + +snippet iti "it (js, inject)" b +it('${1:description}', inject(function($2) { + $0 +})); +endsnippet + +snippet befi "before each (js, inject)" b +beforeEach(inject(function($1) { + $0 +})); +endsnippet + +snippet acon "angular config" i +config(function($1) { + $0 +}); +endsnippet From b1af469ff76e5cfee0b809f89f6976ee5738950e Mon Sep 17 00:00:00 2001 From: Ryan Pineo Date: Mon, 21 Apr 2014 14:12:28 -0400 Subject: [PATCH 08/14] Rename angular config. Add angular controller. --- UltiSnips/javascript_angular.snippets | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/UltiSnips/javascript_angular.snippets b/UltiSnips/javascript_angular.snippets index 23b93e3..76e9ca1 100644 --- a/UltiSnips/javascript_angular.snippets +++ b/UltiSnips/javascript_angular.snippets @@ -12,8 +12,14 @@ beforeEach(inject(function($1) { })); endsnippet -snippet acon "angular config" i +snippet aconf "angular config" i config(function($1) { $0 }); endsnippet + +snippet acont "angular controller" i +controller('${1:name}', function($2) { + $0 +}); +endsnippet From ed8c39bc1f79d0992e3892172f057f8e8b278243 Mon Sep 17 00:00:00 2001 From: Alexandre de Oliveira Date: Wed, 23 Apr 2014 17:59:28 -0300 Subject: [PATCH 09/14] Adds brackets to RSpec's let() --- snippets/ruby.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 6ee11d4..5d9c01e 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -1030,9 +1030,9 @@ snippet aft ${0} end snippet let - let(:${1:object}) ${0} + let(:${1:object}) { ${0} } snippet let! - let!(:${1:object}) ${0} + let!(:${1:object}) { ${0} } snippet subj subject { ${0} } snippet s. From 5edbfec78655c606e595d0db94080de7fe58c4d0 Mon Sep 17 00:00:00 2001 From: r4d2 Date: Thu, 24 Apr 2014 21:14:31 -0400 Subject: [PATCH 10/14] Fix syntax in R for loop --- UltiSnips/r.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/r.snippets b/UltiSnips/r.snippets index d78a1d7..2d67594 100644 --- a/UltiSnips/r.snippets +++ b/UltiSnips/r.snippets @@ -48,7 +48,7 @@ while(${1}) { endsnippet snippet for "for loop" -for ({${1:item} in ${2:list}) { +for (${1:item} in ${2:list}) { ${3} } endsnippet From 74ef5cbd446216995d94f1ddcd2b84619f1125ef Mon Sep 17 00:00:00 2001 From: r4d2 Date: Thu, 24 Apr 2014 21:14:50 -0400 Subject: [PATCH 11/14] Add R for and while snippets --- snippets/r.snippets | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/snippets/r.snippets b/snippets/r.snippets index c7ca5ac..d9b210f 100644 --- a/snippets/r.snippets +++ b/snippets/r.snippets @@ -23,6 +23,16 @@ snippet ei ${0} } +# loops +snippet wh +while(${1}) { + ${2} +} +snippet for +for (${1:item} in ${2:list}) { + ${3} +} + # functions snippet fun ${1:name} = function (${2:variables}) { From 8fe86059fb2a2d5c85aeb2a8787a9bcd8dd68602 Mon Sep 17 00:00:00 2001 From: tinyladi Date: Mon, 28 Apr 2014 12:36:54 +0200 Subject: [PATCH 12/14] create pandoc.snippets & extend markdown.snippets --- UltiSnips/pandoc.snippets | 1 + 1 file changed, 1 insertion(+) create mode 100644 UltiSnips/pandoc.snippets diff --git a/UltiSnips/pandoc.snippets b/UltiSnips/pandoc.snippets new file mode 100644 index 0000000..c94e534 --- /dev/null +++ b/UltiSnips/pandoc.snippets @@ -0,0 +1 @@ +extends markdown From a34551bdd9af52018a92279a40f6b9385c1109f9 Mon Sep 17 00:00:00 2001 From: tinyladi Date: Mon, 28 Apr 2014 12:48:59 +0200 Subject: [PATCH 13/14] add codeblock and inline code snippets to markdown.snippets --- UltiSnips/markdown.snippets | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/UltiSnips/markdown.snippets b/UltiSnips/markdown.snippets index fa708ab..046f6b7 100644 --- a/UltiSnips/markdown.snippets +++ b/UltiSnips/markdown.snippets @@ -39,4 +39,15 @@ snippet img "Image" ![${1:pic alt}](${2:path}${3/.+/ "/}${3:opt title}${3/.+/"/})$0 endsnippet +snippet ilc "Inline Code" +\`$1\`$0 +endsnippet + +snippet cbl "Codeblock" b +\`\`\` +$1 +\`\`\` +$0 +endsnippet + # vim:ft=snippets: From 1d5adc300faffd9672cf2d6fc3b4f37fb7ad5e18 Mon Sep 17 00:00:00 2001 From: tinyladi Date: Mon, 28 Apr 2014 14:40:10 +0200 Subject: [PATCH 14/14] add priority and inword option --- UltiSnips/markdown.snippets | 2 +- UltiSnips/pandoc.snippets | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/UltiSnips/markdown.snippets b/UltiSnips/markdown.snippets index 046f6b7..0720cbf 100644 --- a/UltiSnips/markdown.snippets +++ b/UltiSnips/markdown.snippets @@ -39,7 +39,7 @@ snippet img "Image" ![${1:pic alt}](${2:path}${3/.+/ "/}${3:opt title}${3/.+/"/})$0 endsnippet -snippet ilc "Inline Code" +snippet ilc "Inline Code" i \`$1\`$0 endsnippet diff --git a/UltiSnips/pandoc.snippets b/UltiSnips/pandoc.snippets index c94e534..157c9ef 100644 --- a/UltiSnips/pandoc.snippets +++ b/UltiSnips/pandoc.snippets @@ -1 +1,3 @@ +priority -49 + extends markdown