mirror of
				https://github.com/amix/vimrc
				synced 2025-10-30 21:43:35 +08:00 
			
		
		
		
	Updated plugins
This commit is contained in:
		| @ -194,7 +194,7 @@ endsnippet | ||||
|  | ||||
| snippet head "XHTML <head>" | ||||
| <head> | ||||
| 	<meta http-equiv="Content-type" content="text/html; charset=utf-8"`!p x(snip)`> | ||||
| 	<meta charset="utf-8"> | ||||
| 	<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title> | ||||
| 	$0 | ||||
| </head> | ||||
|  | ||||
| @ -25,8 +25,13 @@ def getArgs(group): | ||||
| 	return [i.split(" ") for i in word.findall(group) ] | ||||
|  | ||||
| def camel(word): | ||||
| 	if not word: return '' | ||||
| 	return word[0].upper() + word[1:] | ||||
|  | ||||
| def mixedCase(word): | ||||
| 	if not word: return '' | ||||
| 	return word[0].lower() + word[1:] | ||||
|  | ||||
| endglobal | ||||
|  | ||||
| snippet sleep "try sleep catch" b | ||||
| @ -173,13 +178,13 @@ default: | ||||
| 	$0 | ||||
| endsnippet | ||||
|  | ||||
| snippet elif "else if" b | ||||
| snippet elif "else if" | ||||
| else if ($1)`!p nl(snip)`{ | ||||
| 	$0 | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet /el(se)?/ "else" br | ||||
| snippet /el(se)?/ "else" r | ||||
| else`!p nl(snip)`{ | ||||
| 	$0 | ||||
| } | ||||
| @ -338,23 +343,23 @@ endsnippet | ||||
|  | ||||
| snippet /get(ter)?/ "getter" br | ||||
| public ${1:String} get${2:Name}() { | ||||
| 	return `!p snip.rv = t[2].lower()`; | ||||
| 	return `!p snip.rv = mixedCase(t[2])`; | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet /set(ter)?/ "setter" br | ||||
| public void set${1:Name}(${2:String} $1) { | ||||
| 	return this.`!p snip.rv = t[1].lower()` = `!p snip.rv = t[1].lower()`; | ||||
| public void set${1:Name}(${2:String} `!p snip.rv = mixedCase(t[1])`) { | ||||
| 	this.`!p snip.rv = mixedCase(t[1])` = `!p snip.rv = mixedCase(t[1])`; | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet /se?tge?t|ge?tse?t|gs/ "setter and getter" br | ||||
| public void set${1:Name}(${2:String} `!p snip.rv = t[1].lower()`) { | ||||
| 	this.`!p snip.rv = t[1].lower()` = `!p snip.rv = t[1].lower()`; | ||||
| public void set${1:Name}(${2:String} `!p snip.rv = mixedCase(t[1])`) { | ||||
| 	this.`!p snip.rv = mixedCase(t[1])` = `!p snip.rv = mixedCase(t[1])`; | ||||
| } | ||||
|  | ||||
| public $2 get$1() { | ||||
| 	return `!p snip.rv = t[1].lower()`; | ||||
| 	return `!p snip.rv = mixedCase(t[1])`; | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
|  | ||||
| @ -120,19 +120,19 @@ endsnippet | ||||
|  | ||||
| snippet gs "PHP Class Getter Setter" b | ||||
| /* | ||||
|  * Getter for ${1/(\w+)\s*;/$1/} | ||||
|  * Getter for $1 | ||||
|  */ | ||||
| public function get${1/(\w+)\s*;/\u$1/}() | ||||
| public function get${1/\w+\s*/\u$0/}() | ||||
| { | ||||
| 	return $this->${1/(\w+)\s*;/$1/};$2 | ||||
| 	return $this->$1;$2 | ||||
| } | ||||
|  | ||||
| /* | ||||
|  * Setter for ${1/(\w+)\s*;/$1/} | ||||
|  * Setter for $1 | ||||
|  */ | ||||
| public function set${1/(\w+)\s*;/\u$1/}($${1/(\w+)\s*;/$1/}) | ||||
| public function set${1/\w+\s*/\u$0/}($$1) | ||||
| { | ||||
| 	$this->${1/(\w+)\s*;/$1/} = $${1/(\w+)\s*;/$1/};$3 | ||||
| 	$this->$1 = $$1;$3 | ||||
| 	${4:return $this;} | ||||
| } | ||||
| $0 | ||||
|  | ||||
							
								
								
									
										52
									
								
								sources_non_forked/vim-snippets/UltiSnips/proto.snippets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								sources_non_forked/vim-snippets/UltiSnips/proto.snippets
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,52 @@ | ||||
| priority -50 | ||||
|  | ||||
| global !p | ||||
| from vimsnippets import complete | ||||
|  | ||||
| FIELD_TYPES = [ | ||||
| 	'double', | ||||
| 	'float', | ||||
| 	'int32', | ||||
| 	'int64', | ||||
| 	'uint32', | ||||
| 	'uint64', | ||||
| 	'sint32', | ||||
| 	'sint64', | ||||
| 	'fixed32', | ||||
| 	'fixed64', | ||||
| 	'sfixed32', | ||||
| 	'sfixed64', | ||||
| 	'bool', | ||||
| 	'string', | ||||
| 	'bytes'] | ||||
| endglobal | ||||
|  | ||||
| snippet mess "Proto message" b | ||||
| // ${2:TODO(`whoami`): Describe this message.} | ||||
| message ${1:Name} { | ||||
| 	$0 | ||||
|  | ||||
| 	// Next available id: 1 | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet reqf "Required field" b | ||||
| // ${4:TODO(`whoami`): Describe this field.} | ||||
| optional ${1}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1};  // Required | ||||
| endsnippet | ||||
|  | ||||
| snippet optf "Optional field" b | ||||
| // ${4:TODO(`whoami`): Describe this field.} | ||||
| optional ${1}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; | ||||
| endsnippet | ||||
|  | ||||
| snippet repf "Repeated field" b | ||||
| // ${4:TODO(`whoami`): Describe this field.} | ||||
| repeated ${1}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; | ||||
| endsnippet | ||||
|  | ||||
| snippet enum "Enumeration" b | ||||
| // ${2:TODO(`whoami`): Describe this enum.} | ||||
| enum ${1:Name} { | ||||
| } | ||||
| endsnippet | ||||
| @ -34,13 +34,30 @@ global !p | ||||
| NORMAL  = 0x1 | ||||
| DOXYGEN = 0x2 | ||||
| SPHINX  = 0x3 | ||||
| GOOGLE  = 0x4 | ||||
|  | ||||
| SINGLE_QUOTES = 0x1 | ||||
| DOUBLE_QUOTES = 0x2 | ||||
|  | ||||
|  | ||||
| class Arg(object): | ||||
| 	def __init__(self, arg): | ||||
| 		self.arg = arg | ||||
| 		self.name = arg.split('=')[0].strip() | ||||
|  | ||||
| 	def __str__(self): | ||||
| 		return self.name | ||||
| 	 | ||||
| 	def __unicode__(self): | ||||
| 		return self.name | ||||
| 	 | ||||
| 	def is_kwarg(self): | ||||
| 		return '=' in self.arg | ||||
|  | ||||
|  | ||||
| def get_args(arglist): | ||||
| 	args = [arg.split('=')[0].strip() for arg in arglist.split(',') if arg] | ||||
| 	args = [arg for arg in args if arg and arg != "self"] | ||||
| 	args = [Arg(arg) for arg in arglist.split(',') if arg] | ||||
| 	args = [arg for arg in args if arg.name != 'self'] | ||||
|  | ||||
| 	return args | ||||
|  | ||||
| @ -51,7 +68,7 @@ def get_quoting_style(snip): | ||||
| 		return SINGLE_QUOTES | ||||
| 	return DOUBLE_QUOTES | ||||
|  | ||||
| def tripple_quotes(snip): | ||||
| def triple_quotes(snip): | ||||
| 	if get_quoting_style(snip) == SINGLE_QUOTES: | ||||
| 		return "'''" | ||||
| 	return '"""' | ||||
| @ -61,6 +78,7 @@ def get_style(snip): | ||||
|  | ||||
| 	if    style == "doxygen": return DOXYGEN | ||||
| 	elif  style == "sphinx": return SPHINX | ||||
| 	elif  style == "google": return GOOGLE | ||||
| 	else: return NORMAL | ||||
|  | ||||
|  | ||||
| @ -71,6 +89,8 @@ def format_arg(arg, style): | ||||
| 		return ":param %s: @todo" % arg | ||||
| 	elif style == NORMAL: | ||||
| 		return ":%s: @todo" % arg | ||||
| 	elif style == GOOGLE: | ||||
| 		return "%s (@todo): @todo" % arg | ||||
|  | ||||
|  | ||||
| def format_return(style): | ||||
| @ -78,19 +98,45 @@ def format_return(style): | ||||
| 		return "@return: @todo" | ||||
| 	elif style in (NORMAL, SPHINX): | ||||
| 		return ":returns: @todo" | ||||
| 	elif style == GOOGLE: | ||||
| 		return "Returns: @todo" | ||||
|  | ||||
|  | ||||
| def write_docstring_args(args, snip): | ||||
| 	if not args: | ||||
| 		snip.rv += ' {0}'.format(tripple_quotes(snip)) | ||||
| 		snip.rv += ' {0}'.format(triple_quotes(snip)) | ||||
| 		return | ||||
|  | ||||
| 	snip.rv += '\n' + snip.mkline('', indent='') | ||||
|  | ||||
| 	style = get_style(snip) | ||||
|  | ||||
| 	for arg in args: | ||||
| 		snip += format_arg(arg, style) | ||||
| 	if style == GOOGLE: | ||||
| 		write_google_docstring_args(args, snip) | ||||
| 	else: | ||||
| 		for arg in args: | ||||
| 			snip += format_arg(arg, style) | ||||
|  | ||||
|  | ||||
| def write_google_docstring_args(args, snip): | ||||
| 	kwargs = [arg for arg in args if arg.is_kwarg()] | ||||
| 	args = [arg for arg in args if not arg.is_kwarg()] | ||||
|  | ||||
| 	if args: | ||||
| 		snip += "Args:" | ||||
| 		snip.shift() | ||||
| 		for arg in args: | ||||
| 			snip += format_arg(arg, GOOGLE) | ||||
| 		snip.unshift() | ||||
| 		snip.rv += '\n' + snip.mkline('', indent='') | ||||
|  | ||||
| 	if kwargs: | ||||
| 		snip += "Kwargs:" | ||||
| 		snip.shift() | ||||
| 		for kwarg in kwargs: | ||||
| 			snip += format_arg(kwarg, GOOGLE) | ||||
| 		snip.unshift() | ||||
| 		snip.rv += '\n' + snip.mkline('', indent='') | ||||
|  | ||||
|  | ||||
| def write_init_body(args, parents, snip): | ||||
| @ -120,10 +166,10 @@ endglobal | ||||
| snippet class "class with docstrings" b | ||||
| class ${1:MyClass}(${2:object}): | ||||
|  | ||||
| 	`!p snip.rv = tripple_quotes(snip)`${3:Docstring for $1. }`!p snip.rv = tripple_quotes(snip)` | ||||
| 	`!p snip.rv = triple_quotes(snip)`${3:Docstring for $1. }`!p snip.rv = triple_quotes(snip)` | ||||
|  | ||||
| 	def __init__(self$4): | ||||
| 		`!p snip.rv = tripple_quotes(snip)`${5:@todo: to be defined1.}`!p | ||||
| 		`!p snip.rv = triple_quotes(snip)`${5:@todo: to be defined1.}`!p | ||||
| snip.rv = "" | ||||
| snip >> 2 | ||||
|  | ||||
| @ -132,7 +178,7 @@ args = get_args(t[4]) | ||||
| write_docstring_args(args, snip) | ||||
| if args: | ||||
| 	snip.rv += '\n' + snip.mkline('', indent='') | ||||
| 	snip += '{0}'.format(tripple_quotes(snip)) | ||||
| 	snip += '{0}'.format(triple_quotes(snip)) | ||||
|  | ||||
| write_init_body(args, t[2], snip) | ||||
| ` | ||||
| @ -143,7 +189,7 @@ endsnippet | ||||
| snippet slotclass "class with slots and docstrings" b | ||||
| class ${1:MyClass}(${2:object}): | ||||
|  | ||||
| 	`!p snip.rv = tripple_quotes(snip)`${3:Docstring for $1. }`!p snip.rv = tripple_quotes(snip)` | ||||
| 	`!p snip.rv = triple_quotes(snip)`${3:Docstring for $1. }`!p snip.rv = triple_quotes(snip)` | ||||
| `!p | ||||
| snip >> 1 | ||||
| args = get_args(t[4]) | ||||
| @ -151,7 +197,7 @@ write_slots_args(args, snip) | ||||
| ` | ||||
|  | ||||
| 	def __init__(self$4): | ||||
| 		`!p snip.rv = tripple_quotes(snip)`${5:@todo: to be defined.}`!p | ||||
| 		`!p snip.rv = triple_quotes(snip)`${5:@todo: to be defined.}`!p | ||||
| snip.rv = "" | ||||
| snip >> 2 | ||||
|  | ||||
| @ -160,7 +206,7 @@ args = get_args(t[4]) | ||||
| write_docstring_args(args, snip) | ||||
| if args: | ||||
| 	snip.rv += '\n' + snip.mkline('', indent='') | ||||
| 	snip += tripple_quotes(snip) | ||||
| 	snip += triple_quotes(snip) | ||||
|  | ||||
| write_init_body(args, t[2], snip) | ||||
| ` | ||||
| @ -353,7 +399,7 @@ snippet def "function with docstrings" b | ||||
| def ${1:function}(`!p | ||||
| if snip.indent: | ||||
| 	snip.rv = 'self' + (", " if len(t[2]) else "")`${2:arg1}): | ||||
| 	`!p snip.rv = tripple_quotes(snip)`${4:@todo: Docstring for $1.}`!p | ||||
| 	`!p snip.rv = triple_quotes(snip)`${4:@todo: Docstring for $1.}`!p | ||||
| snip.rv = "" | ||||
| snip >> 1 | ||||
|  | ||||
| @ -364,7 +410,7 @@ if args: | ||||
| style = get_style(snip) | ||||
| snip += format_return(style) | ||||
| snip.rv += '\n' + snip.mkline('', indent='') | ||||
| snip += tripple_quotes(snip) ` | ||||
| snip += triple_quotes(snip) ` | ||||
| 	${0:pass} | ||||
| endsnippet | ||||
|  | ||||
| @ -390,7 +436,7 @@ endsnippet | ||||
|  | ||||
| snippet rwprop "Read write property" b | ||||
| def ${1:name}(): | ||||
| 	`!p snip.rv = tripple_quotes(snip) if t[2] else '' | ||||
| 	`!p snip.rv = triple_quotes(snip) if t[2] else '' | ||||
| `${2:@todo: Docstring for $1.}`!p | ||||
| if t[2]: | ||||
| 	snip >> 1 | ||||
| @ -399,7 +445,7 @@ if t[2]: | ||||
| 	snip.rv += '\n' + snip.mkline('', indent='') | ||||
| 	snip += format_return(style) | ||||
| 	snip.rv += '\n' + snip.mkline('', indent='') | ||||
| 	snip += tripple_quotes(snip) | ||||
| 	snip += triple_quotes(snip) | ||||
| else: | ||||
| 	snip.rv = ""` | ||||
| 	def fget(self): | ||||
| @ -518,7 +564,7 @@ endsnippet | ||||
| snippet testcase "pyunit testcase" b | ||||
| class Test${1:Class}(${2:unittest.TestCase}): | ||||
|  | ||||
| 	`!p snip.rv = tripple_quotes(snip)`${3:Test case docstring.}`!p snip.rv = tripple_quotes(snip)` | ||||
| 	`!p snip.rv = triple_quotes(snip)`${3:Test case docstring.}`!p snip.rv = triple_quotes(snip)` | ||||
|  | ||||
| 	def setUp(self): | ||||
| 		${4:pass} | ||||
|  | ||||
							
								
								
									
										144
									
								
								sources_non_forked/vim-snippets/UltiSnips/r.snippets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										144
									
								
								sources_non_forked/vim-snippets/UltiSnips/r.snippets
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,144 @@ | ||||
| priority -50 | ||||
|  | ||||
| snippet #! "Hashbang for Rscript (#!)" b | ||||
| #!/usr/bin/env Rscript | ||||
| endsnippet | ||||
|  | ||||
| snippet lib "Import a library" | ||||
| library(${0:package}) | ||||
| endsnippet | ||||
|  | ||||
| snippet req "Require a file" | ||||
| require(${0:package}) | ||||
| endsnippet | ||||
|  | ||||
| snippet source "Source a file" | ||||
| source('${0:file}') | ||||
| endsnippet | ||||
|  | ||||
| snippet if "If statement" | ||||
| if (${1}) { | ||||
| 	${0} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet eif "Else-If statement" | ||||
| else if (${1}) { | ||||
| 	${0} | ||||
| } | ||||
|  | ||||
| snippet el "Else statement" | ||||
| else { | ||||
| 	${0} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet ife "if .. else" | ||||
| if (${1}) { | ||||
| 	${2} | ||||
| } else { | ||||
| 	${3} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet wh "while loop" | ||||
| while(${1}) { | ||||
| 	${2} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet for "for loop" | ||||
| for ({${1:item} in ${2:list}) { | ||||
| 	${3} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet fun "Function definition" | ||||
| ${1:name} <- function (${2}) { | ||||
| 	${0} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet ret "Return call" | ||||
| return(${0}) | ||||
| endsnippet | ||||
|  | ||||
| snippet df "Data frame" | ||||
| ${1:name}[${2:rows}, ${0:cols}] | ||||
| endsnippet | ||||
|  | ||||
| snippet c "c function" | ||||
| c(${0:items}) | ||||
| endsnippet | ||||
|  | ||||
| snippet li "list function" | ||||
| list(${0:items}) | ||||
| endsnippet | ||||
|  | ||||
| snippet mat "matrix function" | ||||
| matrix(${1:data}, nrow = ${2:rows}, ncol = ${0:cols}) | ||||
| endsnippet | ||||
|  | ||||
| snippet apply "apply function" | ||||
| apply(${1:array}, ${2:margin}, ${0:function}) | ||||
| endsnippet | ||||
|  | ||||
| snippet lapply "lapply function" | ||||
| lapply(${1:list}, ${0:function}) | ||||
| endsnippet | ||||
|  | ||||
| snippet sapply "sapply function" | ||||
| lapply(${1:list}, ${0:function}) | ||||
| endsnippet | ||||
|  | ||||
| snippet vapply "vapply function" | ||||
| vapply(${1:list}, ${2:function}, ${0:type}) | ||||
| endsnippet | ||||
|  | ||||
| snippet mapply "mapply function" | ||||
| mapply(${1:function}, ${0:...}) | ||||
| endsnippet | ||||
|  | ||||
| snippet tapply "tapply function" | ||||
| tapply(${1:vector}, ${2:index}, ${0:function}) | ||||
| endsnippet | ||||
|  | ||||
| snippet rapply "rapply function" | ||||
| rapply(${1:list}, ${0:function}) | ||||
| endsnippet | ||||
|  | ||||
| snippet pl "Plot function" | ||||
| plot(${1:x}, ${0:y}) | ||||
| endsnippet | ||||
|  | ||||
| snippet ggp "ggplot2 plot" | ||||
| ggplot(${1:data}, aes(${0:aesthetics})) | ||||
| endsnippet | ||||
|  | ||||
| snippet fis "Fisher test" | ||||
| fisher.test(${1:x}, ${0:y}) | ||||
| endsnippet | ||||
|  | ||||
| snippet chi "Chi Squared test" | ||||
| chisq.test(${1:x}, ${0:y}) | ||||
| endsnippet | ||||
|  | ||||
| snippet tt "t-test" | ||||
| t.test(${1:x}, ${0:y}) | ||||
| endsnippet | ||||
|  | ||||
| snippet wil "Wilcox test" | ||||
| wilcox.test(${1:x}, ${0:y}) | ||||
| endsnippet | ||||
|  | ||||
| snippet cor "Correlation test" | ||||
| cor.test(${1:x}, ${0:y}) | ||||
| endsnippet | ||||
|  | ||||
| snippet fte "FTE test" | ||||
| var.test(${1:x}, ${0:y}) | ||||
| endsnippet | ||||
|  | ||||
| snippet kvt "KV test" | ||||
| kv.test(${1:x}, ${0:y}) | ||||
| endsnippet | ||||
| @ -0,0 +1,3 @@ | ||||
| priority -50 | ||||
|  | ||||
| extends tex, r | ||||
| @ -12,6 +12,8 @@ from string import Template | ||||
| import re | ||||
| from collections import Counter | ||||
|  | ||||
| from vimsnippets import complete | ||||
|  | ||||
| #http://docutils.sourceforge.net/docs/ref/rst/roles.html | ||||
| TEXT_ROLES = ['emphasis','literal','code','math', | ||||
| 			  'pep-reference','rfc-reference', | ||||
| @ -130,27 +132,6 @@ def get_popular_code_type(): | ||||
| 	except IndexError: | ||||
| 		popular_type = "lua" # Don't break default | ||||
| 	return popular_type | ||||
|  | ||||
|  | ||||
| def complete(t, opts): | ||||
| 	""" | ||||
| 	get options that start with t | ||||
|  | ||||
| 	:param t: query string | ||||
| 	:param opts: list that needs to be completed | ||||
|  | ||||
| 	:return: a string that start with t | ||||
| 	""" | ||||
| 	msg = "({0})" | ||||
| 	if t: | ||||
| 		opts = [ m[len(t):] for m in opts if m.startswith(t) ] | ||||
| 	if len(opts) == 1: | ||||
| 		return opts[0] | ||||
|  | ||||
| 	if not len(opts): | ||||
| 		msg = "{0}" | ||||
| 	return msg.format("|".join(opts)) | ||||
|  | ||||
| endglobal | ||||
|  | ||||
| snippet part "Part" b | ||||
|  | ||||
							
								
								
									
										215
									
								
								sources_non_forked/vim-snippets/UltiSnips/rust.snippets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										215
									
								
								sources_non_forked/vim-snippets/UltiSnips/rust.snippets
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,215 @@ | ||||
| ####################################################################### | ||||
| #                            Rust Snippets                            # | ||||
| ####################################################################### | ||||
|  | ||||
| ############### | ||||
| #  Functions  # | ||||
| ############### | ||||
| snippet fn "A function, optionally with arguments and return type." | ||||
| fn ${1:function_name}(${2})${3/..*/ -> /}${3} { | ||||
| 	${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet test "Test function" | ||||
| #[test] | ||||
| fn ${1:test_function_name}() { | ||||
| 	${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet new "A new function" | ||||
| pub fn new(${2}) -> ${1:Name} { | ||||
| 	${VISUAL}${0}return $1 { ${3} }; | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet main "The main function" | ||||
| pub fn main() { | ||||
| 	${VISUAL}${0} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
|  | ||||
|  | ||||
| snippet let "A let statement" | ||||
| let ${1:name}${3} = ${VISUAL}${2}; | ||||
| endsnippet | ||||
|  | ||||
| snippet pln "println!(..)" b | ||||
| println!("${1}"${2/..*/, /}${2}); | ||||
| endsnippet | ||||
|  | ||||
|  | ||||
|  | ||||
| snippet ec "extern crate ..." b | ||||
| extern crate ${1:sync}; | ||||
| endsnippet | ||||
|  | ||||
| snippet ecl "...extern crate log;" b | ||||
| #![feature(phase)] | ||||
| #[phase(syntax, link)] extern crate log; | ||||
| endsnippet | ||||
|  | ||||
| snippet mod	 "A mod." b | ||||
| mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} { | ||||
| 	${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} | ||||
| } /* $1 */ | ||||
| endsnippet | ||||
|  | ||||
| snippet crate "Create header information" b | ||||
| // Crate ID | ||||
| #![crate_id = "${1:crate_name}#${2:0.0.1}"] | ||||
|  | ||||
| // Additional metadata attributes | ||||
| #![desc = "${3:Descrption.}"] | ||||
| #![license = "${4:BSD}"] | ||||
| #![comment = "${5:Comment.}"] | ||||
|  | ||||
| // Specify the output type | ||||
| #![crate_type = "${6:lib}"] | ||||
| endsnippet | ||||
|  | ||||
| snippet allow "#[allow(..)]" b | ||||
| #[allow(${1:unused_variable})] | ||||
| endsnippet | ||||
|  | ||||
| snippet feat "#![feature(..)]" b | ||||
| #![feature(${1:macro_rules})] | ||||
| endsnippet | ||||
|  | ||||
|  | ||||
| ################## | ||||
| #  Common types  # | ||||
| ################## | ||||
| snippet opt "Option<..>" | ||||
| Option<${1:int}> | ||||
| endsnippet | ||||
|  | ||||
| snippet res "Result<.., ..>" | ||||
| Result<${1:~str}, ${2:()}> | ||||
| endsnippet | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| snippet if "if .. (if)" b | ||||
| if ${1:/* condition */} { | ||||
| 	${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet mat "match" | ||||
| match ${1} { | ||||
| 	${2} => ${3}, | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet while "while .. {}" b | ||||
| while ${1:condition} { | ||||
| 	${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet for "for .. in .." b | ||||
| for ${1:i} in ${2:range(0u, 10)} { | ||||
| 	${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet spawn "spawn(proc() { .. });" b | ||||
| spawn(proc() { | ||||
| 	${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} | ||||
| }); | ||||
| endsnippet | ||||
|  | ||||
| snippet chan "A channel" b | ||||
| let (${1:tx}, ${2:rx}): (Sender<${3:int}>, Receiver<${4:int}>) = channel(); | ||||
| endsnippet | ||||
|  | ||||
| snippet duplex "Duplex stream" b | ||||
| let (${1:from_child}, ${2:to_child}) = sync::duplex(); | ||||
| endsnippet | ||||
|  | ||||
| ##################### | ||||
| #  TODO commenting  # | ||||
| ##################### | ||||
| snippet todo "A Todo comment" | ||||
| // [TODO]: ${1:Description} - `!v strftime("%Y-%m-%d %I:%M%P")` | ||||
| endsnippet | ||||
|  | ||||
|  | ||||
| ############ | ||||
| #  Struct  # | ||||
| ############ | ||||
| snippet st "Struct" b | ||||
| struct ${1:`!p snip.rv = snip.basename.title() or "name"`} { | ||||
| 	${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet stn "Struct with new constructor." b | ||||
| pub struct ${1:`!p snip.rv = snip.basename.title() or "name"`} { | ||||
| 	${3:/* code */} | ||||
| } | ||||
|  | ||||
| impl $1 { | ||||
| 	pub fn new(${2}) -> $1 { | ||||
| 		${4}return $1 { | ||||
| 			${5} | ||||
| 		}; | ||||
| 	} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
|  | ||||
| ########## | ||||
| #  Enum  # | ||||
| ########## | ||||
| snippet enum "An enum" b | ||||
| enum ${1:enum_name} { | ||||
| 	${VISUAL}${0}, | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
|  | ||||
| ########## | ||||
| #  Impl  # | ||||
| ########## | ||||
| snippet imp "An impl" b | ||||
| impl ${1:Name} { | ||||
| 	${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet drop "Drop implementation" b | ||||
| impl Drop for ${1:Name} { | ||||
| 	fn drop(&mut self) { | ||||
| 		${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} | ||||
| 	} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
|  | ||||
| ############ | ||||
| #  Traits  # | ||||
| ############ | ||||
| snippet trait "Trait block" b | ||||
| trait ${1:Name} { | ||||
| 	${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
|  | ||||
| ############# | ||||
| #  Statics  # | ||||
| ############# | ||||
| snippet ss "A static string." | ||||
| static ${1}: &'static str = "${VISUAL}${0}"; | ||||
| endsnippet | ||||
|  | ||||
| snippet stat "A static variable." | ||||
| static ${1}: ${2:uint} = ${VISUAL}${0}; | ||||
| endsnippet | ||||
|  | ||||
| # vim:ft=snippets: | ||||
							
								
								
									
										63
									
								
								sources_non_forked/vim-snippets/UltiSnips/soy.snippets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								sources_non_forked/vim-snippets/UltiSnips/soy.snippets
									
									
									
									
									
										Normal 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 | ||||
		Reference in New Issue
	
	Block a user
	 amix
					amix