Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Felix Jung 2014-04-30 10:09:15 +02:00
commit ebbd6a8ddc
11 changed files with 174 additions and 60 deletions

View File

@ -16,7 +16,7 @@ endsnippet
snippet #if "#if #endif" b snippet #if "#if #endif" b
#if ${1:0} #if ${1:0}
${VISUAL}${0:${VISUAL/(.*)/(?1::code)/}} ${VISUAL}${0}
#endif #endif
endsnippet endsnippet
@ -40,7 +40,7 @@ endsnippet
snippet main "main() (main)" snippet main "main() (main)"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
return 0; return 0;
} }
endsnippet endsnippet
@ -48,14 +48,14 @@ endsnippet
snippet for "for loop (for)" snippet for "for loop (for)"
for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}) for (${2:i} = 0; $2 < ${1:count}; ${3:++$2})
{ {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} }
endsnippet endsnippet
snippet fori "for int loop (fori)" snippet fori "for int loop (fori)"
for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2})
{ {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} }
endsnippet endsnippet
@ -86,13 +86,13 @@ endsnippet
snippet wh "while loop" snippet wh "while loop"
while(${1:/* condition */}) { while(${1:/* condition */}) {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} }
endsnippet endsnippet
snippet do "do...while loop (do)" snippet do "do...while loop (do)"
do { do {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} while(${1:/* condition */}); } while(${1:/* condition */});
endsnippet endsnippet
@ -103,26 +103,26 @@ endsnippet
snippet if "if .. (if)" snippet if "if .. (if)"
if (${1:/* condition */}) if (${1:/* condition */})
{ {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} }
endsnippet endsnippet
snippet el "else .. (else)" snippet el "else .. (else)"
else { else {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} }
endsnippet endsnippet
snippet eli "else if .. (eli)" snippet eli "else if .. (eli)"
else if (${1:/* condition */}) { else if (${1:/* condition */}) {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} }
endsnippet endsnippet
snippet ife "if .. else (ife)" snippet ife "if .. else (ife)"
if (${1:/* condition */}) if (${1:/* condition */})
{ {
${2:/* code */} ${2}
} }
else else
{ {
@ -144,7 +144,7 @@ endsnippet
snippet fun "function" b snippet fun "function" b
${1:void} ${2:function_name}(${3}) ${1:void} ${2:function_name}(${3})
{ {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} }
endsnippet endsnippet

View File

@ -27,7 +27,7 @@ endsnippet
snippet ns "namespace .. (namespace)" snippet ns "namespace .. (namespace)"
namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`} namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`}
{ {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
}${1/.+/ \/* /m}$1${1/.+/ *\/ /m} }${1/.+/ \/* /m}$1${1/.+/ *\/ /m}
endsnippet endsnippet

View File

@ -106,14 +106,14 @@ endsnippet
snippet if "if .. (if)" snippet if "if .. (if)"
if(${1:/*condition*/}) if(${1:/*condition*/})
{ {
${VISUAL}${0:/*code*/} ${VISUAL}${0}
} }
endsnippet endsnippet
snippet ife "if .. else (ife)" b snippet ife "if .. else (ife)" b
if(${1:/*condition*/}) if(${1:/*condition*/})
{ {
${2:/*code*/} ${2}
} }
else else
{ {
@ -124,14 +124,14 @@ endsnippet
snippet el "else (el)" b snippet el "else (el)" b
else else
{ {
${VISUAL}${1:/*code*/} ${VISUAL}${1}
} }
endsnippet endsnippet
snippet elif "else if (elif)" b snippet elif "else if (elif)" b
else if(${1:/*condition*/}) else if(${1:/*condition*/})
{ {
${VISUAL}${0:/*code*/} ${VISUAL}${0}
} }
endsnippet endsnippet
@ -139,10 +139,10 @@ snippet sw "switch (sw)"
switch(${1:/*var*/}) switch(${1:/*var*/})
{ {
case ${2:/*value*/}: case ${2:/*value*/}:
${3:/*code*/} ${3}
break; break;
case ${4:/*value*/}: case ${4:/*value*/}:
${5:/*code*/} ${5}
break; break;
${7:/*more cases*/} ${7:/*more cases*/}
default: default:
@ -154,10 +154,10 @@ snippet fsw "final switch (fsw)"
switch(${1:/*var*/}) switch(${1:/*var*/})
{ {
case ${2:/*value*/}: case ${2:/*value*/}:
${3:/*code*/} ${3}
break; break;
case ${4:/*value*/}: case ${4:/*value*/}:
${5:/*code*/} ${5}
break; break;
${7:/*more cases*/} ${7:/*more cases*/}
} }
@ -165,7 +165,7 @@ endsnippet
snippet case "case (case)" b snippet case "case (case)" b
case ${1:/*value*/}: case ${1:/*value*/}:
${2:/*code*/} ${2}
break; break;
endsnippet endsnippet
@ -178,42 +178,42 @@ endsnippet
snippet do "do while (do)" b snippet do "do while (do)" b
do do
{ {
${VISUAL}${2:/*code*/} ${VISUAL}${2}
} while(${1:/*condition*/}); } while(${1:/*condition*/});
endsnippet endsnippet
snippet wh "while (wh)" b snippet wh "while (wh)" b
while(${1:/*condition*/}) while(${1:/*condition*/})
{ {
${VISUAL}${2:/*code*/} ${VISUAL}${2}
} }
endsnippet endsnippet
snippet for "for (for)" b snippet for "for (for)" b
for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2})
{ {
${VISUAL}${0:/*code*/} ${VISUAL}${0}
} }
endsnippet endsnippet
snippet forever "forever (forever)" b snippet forever "forever (forever)" b
for(;;) for(;;)
{ {
${VISUAL}${0:/*code*/} ${VISUAL}${0}
} }
endsnippet endsnippet
snippet fore "foreach (fore)" snippet fore "foreach (fore)"
foreach(${1:/*elem*/}; ${2:/*range*/}) foreach(${1:/*elem*/}; ${2:/*range*/})
{ {
${VISUAL}${3:/*code*/} ${VISUAL}${3}
} }
endsnippet endsnippet
snippet forif "foreach if (forif)" b snippet forif "foreach if (forif)" b
foreach(${1:/*elem*/}; ${2:/*range*/}) if(${3:/*condition*/}) foreach(${1:/*elem*/}; ${2:/*range*/}) if(${3:/*condition*/})
{ {
${VISUAL}${4:/*code*/} ${VISUAL}${4}
} }
endsnippet endsnippet
@ -249,21 +249,21 @@ endsnippet
snippet fun "function definition (fun)" snippet fun "function definition (fun)"
${1:void} ${2:/*function name*/}(${3:/*args*/}) ${4:@safe pure nothrow} ${1:void} ${2:/*function name*/}(${3:/*args*/}) ${4:@safe pure nothrow}
{ {
${VISUAL}${5:/*code*/} ${VISUAL}${5}
} }
endsnippet endsnippet
snippet void "void function definition (void)" snippet void "void function definition (void)"
void ${1:/*function name*/}(${2:/*args*/}) ${3:@safe pure nothrow} void ${1:/*function name*/}(${2:/*args*/}) ${3:@safe pure nothrow}
{ {
${VISUAL}${4:/*code*/} ${VISUAL}${4}
} }
endsnippet endsnippet
snippet this "ctor (this)" w snippet this "ctor (this)" w
this(${1:/*args*/}) this(${1:/*args*/})
{ {
${VISUAL}${2:/*code*/} ${VISUAL}${2}
} }
endsnippet endsnippet
@ -295,7 +295,7 @@ endsnippet
snippet scope "scope (scope)" b snippet scope "scope (scope)" b
scope(${1:exit}) scope(${1:exit})
{ {
${VISUAL}${2:/*code*/} ${VISUAL}${2}
} }
endsnippet endsnippet
@ -304,7 +304,7 @@ endsnippet
snippet with "with (with)" snippet with "with (with)"
with(${1}) with(${1})
{ {
${VISUAL}${2:/*code*/} ${VISUAL}${2}
} }
endsnippet endsnippet
@ -405,14 +405,14 @@ endsnippet
snippet version "version (version)" b snippet version "version (version)" b
version(${1:/*version name*/}) version(${1:/*version name*/})
{ {
${VISUAL}${2:/*code*/} ${VISUAL}${2}
} }
endsnippet endsnippet
snippet debug "debug" b snippet debug "debug" b
debug debug
{ {
${VISUAL}${1:/*code*/} ${VISUAL}${1}
} }
endsnippet endsnippet
@ -422,7 +422,7 @@ endsnippet
snippet temp "template (temp)" b snippet temp "template (temp)" b
template ${2:/*name*/}(${1:/*args*/}) template ${2:/*name*/}(${1:/*args*/})
{ {
${3:/*code*/} ${3}
} }
endsnippet endsnippet
@ -440,7 +440,7 @@ endsnippet
snippet unittest "unittest (unittest)" b snippet unittest "unittest (unittest)" b
unittest unittest
{ {
${1:/*code*/} ${1}
} }
endsnippet endsnippet
@ -450,21 +450,21 @@ endsnippet
snippet opDis "opDispatch (opDis)" b snippet opDis "opDispatch (opDis)" b
${1:/*return type*/} opDispatch(string s)() ${1:/*return type*/} opDispatch(string s)()
{ {
${2:/*code*/}; ${2};
} }
endsnippet endsnippet
snippet op= "opAssign (op=)" b snippet op= "opAssign (op=)" b
void opAssign(${1} rhs) ${2:@safe pure nothrow} void opAssign(${1} rhs) ${2:@safe pure nothrow}
{ {
${2:/*code*/} ${2}
} }
endsnippet endsnippet
snippet opCmp "opCmp (opCmp)" b snippet opCmp "opCmp (opCmp)" b
int opCmp(${1} rhs) @safe const pure nothrow int opCmp(${1} rhs) @safe const pure nothrow
{ {
${2:/*code*/} ${2}
} }
endsnippet endsnippet
@ -484,7 +484,7 @@ endsnippet
snippet toString "toString (toString)" b snippet toString "toString (toString)" b
string toString() @safe const pure nothrow string toString() @safe const pure nothrow
{ {
${1:/*code*/} ${1}
} }
endsnippet endsnippet

View File

@ -0,0 +1,25 @@
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 aconf "angular config" i
config(function($1) {
$0
});
endsnippet
snippet acont "angular controller" i
controller('${1:name}', function($2) {
$0
});
endsnippet

View File

@ -39,4 +39,15 @@ snippet img "Image"
![${1:pic alt}](${2:path}${3/.+/ "/}${3:opt title}${3/.+/"/})$0 ![${1:pic alt}](${2:path}${3/.+/ "/}${3:opt title}${3/.+/"/})$0
endsnippet endsnippet
snippet ilc "Inline Code" i
\`$1\`$0
endsnippet
snippet cbl "Codeblock" b
\`\`\`
$1
\`\`\`
$0
endsnippet
# vim:ft=snippets: # vim:ft=snippets:

View File

@ -0,0 +1,3 @@
priority -49
extends markdown

View File

@ -48,7 +48,7 @@ while(${1}) {
endsnippet endsnippet
snippet for "for loop" snippet for "for loop"
for ({${1:item} in ${2:list}) { for (${1:item} in ${2:list}) {
${3} ${3}
} }
endsnippet endsnippet

View File

@ -2,29 +2,31 @@
# Rust Snippets # # Rust Snippets #
####################################################################### #######################################################################
priority -50
############### ###############
# Functions # # 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} { fn ${1:function_name}(${2})${3/..*/ -> /}${3} {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} }
endsnippet endsnippet
snippet test "Test function" snippet test "Test function" b
#[test] #[test]
fn ${1:test_function_name}() { fn ${1:test_function_name}() {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} }
endsnippet endsnippet
snippet new "A new function" snippet new "A new function" b
pub fn new(${2}) -> ${1:Name} { pub fn new(${2}) -> ${1:Name} {
${VISUAL}${0}return $1 { ${3} }; ${VISUAL}${0}return $1 { ${3} };
} }
endsnippet endsnippet
snippet main "The main function" snippet main "The main function" b
pub fn main() { pub fn main() {
${VISUAL}${0} ${VISUAL}${0}
} }
@ -32,7 +34,7 @@ endsnippet
snippet let "A let statement" snippet let "A let statement" b
let ${1:name}${3} = ${VISUAL}${2}; let ${1:name}${3} = ${VISUAL}${2};
endsnippet endsnippet
@ -53,7 +55,7 @@ endsnippet
snippet mod "A mod." b snippet mod "A mod." b
mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} { mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} /* $1 */ } /* $1 */
endsnippet endsnippet
@ -95,7 +97,7 @@ endsnippet
snippet if "if .. (if)" b snippet if "if .. (if)" b
if ${1:/* condition */} { if ${1:/* condition */} {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} }
endsnippet endsnippet
@ -107,19 +109,19 @@ endsnippet
snippet while "while .. {}" b snippet while "while .. {}" b
while ${1:condition} { while ${1:condition} {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} }
endsnippet endsnippet
snippet for "for .. in .." b snippet for "for .. in .." b
for ${1:i} in ${2:range(0u, 10)} { for ${1:i} in ${2:range(0u, 10)} {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} }
endsnippet endsnippet
snippet spawn "spawn(proc() { .. });" b snippet spawn "spawn(proc() { .. });" b
spawn(proc() { spawn(proc() {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
}); });
endsnippet endsnippet
@ -144,13 +146,13 @@ endsnippet
############ ############
snippet st "Struct" b snippet st "Struct" b
struct ${1:`!p snip.rv = snip.basename.title() or "name"`} { struct ${1:`!p snip.rv = snip.basename.title() or "name"`} {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} }
endsnippet endsnippet
snippet stn "Struct with new constructor." b snippet stn "Struct with new constructor." b
pub struct ${1:`!p snip.rv = snip.basename.title() or "name"`} { pub struct ${1:`!p snip.rv = snip.basename.title() or "name"`} {
${3:/* code */} ${3}
} }
impl $1 { impl $1 {
@ -178,14 +180,14 @@ endsnippet
########## ##########
snippet imp "An impl" b snippet imp "An impl" b
impl ${1:Name} { impl ${1:Name} {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} }
endsnippet endsnippet
snippet drop "Drop implementation" b snippet drop "Drop implementation" b
impl Drop for ${1:Name} { impl Drop for ${1:Name} {
fn drop(&mut self) { fn drop(&mut self) {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} }
} }
endsnippet endsnippet
@ -196,7 +198,7 @@ endsnippet
############ ############
snippet trait "Trait block" b snippet trait "Trait block" b
trait ${1:Name} { trait ${1:Name} {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0}
} }
endsnippet endsnippet

63
UltiSnips/soy.snippets Normal file
View File

@ -0,0 +1,63 @@
priority -50
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

View File

@ -23,6 +23,16 @@ snippet ei
${0} ${0}
} }
# loops
snippet wh
while(${1}) {
${2}
}
snippet for
for (${1:item} in ${2:list}) {
${3}
}
# functions # functions
snippet fun snippet fun
${1:name} <- function (${2:variables}) { ${1:name} <- function (${2:variables}) {

View File

@ -1030,9 +1030,9 @@ snippet aft
${0} ${0}
end end
snippet let snippet let
let(:${1:object}) ${0} let(:${1:object}) { ${0} }
snippet let! snippet let!
let!(:${1:object}) ${0} let!(:${1:object}) { ${0} }
snippet subj snippet subj
subject { ${0} } subject { ${0} }
snippet s. snippet s.