mirror of
				https://github.com/amix/vimrc
				synced 2025-10-31 14:43:35 +08:00 
			
		
		
		
	Updated vim plugins
This commit is contained in:
		| @ -11,11 +11,6 @@ snippet pfn "Function definition" | ||||
| 	pub fn ${1:function_name}(${2})${3} { | ||||
| 		${0} | ||||
| 	} | ||||
| snippet test "Unit test function" | ||||
| 	#[test] | ||||
| 	fn ${1:test_function_name}() { | ||||
| 		${0} | ||||
| 	} | ||||
| snippet bench "Bench function" b | ||||
| 	#[bench] | ||||
| 	fn ${1:bench_function_name}(b: &mut test::Bencher) { | ||||
| @ -24,7 +19,7 @@ snippet bench "Bench function" b | ||||
| 		}) | ||||
| 	} | ||||
| snippet new "Constructor function" | ||||
| 	pub fn new(${2}) -> ${1:Name} { | ||||
| 	pub fn new(${2}) -> ${1:Self} { | ||||
| 		$1 { ${3} } | ||||
| 	} | ||||
| snippet main "Main function" | ||||
| @ -60,6 +55,16 @@ snippet mod | ||||
| 	mod ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} { | ||||
| 		${0} | ||||
| 	} /* $1 */ | ||||
| # Testing | ||||
| snippet as "assert!" | ||||
| 	assert!(${1:predicate}); | ||||
| snippet ase "assert_eq!" | ||||
| 	assert_eq!(${1:expected}, ${2:actual}); | ||||
| snippet test "Unit test function" | ||||
| 	#[test] | ||||
| 	fn ${1:function_name}_test() { | ||||
| 		${0} | ||||
| 	} | ||||
| snippet testmod "Test module" b | ||||
| 	#[cfg(test)] | ||||
| 	mod tests { | ||||
| @ -117,6 +122,8 @@ snippet mat "match pattern" | ||||
| 	} | ||||
| snippet case "Case clause of pattern match" | ||||
| 	${1:_} => ${2:expression} | ||||
| snippet = "=> " | ||||
| 	=> $0 | ||||
| snippet loop "loop {}" b | ||||
| 	loop { | ||||
| 		${0:${VISUAL}} | ||||
| @ -131,7 +138,7 @@ snippet for "for ... in ... loop" | ||||
| 	} | ||||
| # TODO commenting | ||||
| snippet todo "TODO comment" | ||||
| 	// [TODO]: ${0:Description} | ||||
| 	// TODO: $0 | ||||
| snippet fixme "FIXME comment" | ||||
| 	// FIXME: $0 | ||||
| # Struct | ||||
| @ -153,12 +160,16 @@ snippet stn "Struct with new constructor" | ||||
| 			$1 { ${3} } | ||||
| 		} | ||||
| 	} | ||||
| snippet type "Type alias" | ||||
| snippet ty "Type alias" | ||||
| 	type ${1:NewName} = $2; | ||||
| snippet enum "enum definition" | ||||
| 	enum ${1:Name} { | ||||
| 		${2}, | ||||
| 	} | ||||
| snippet penum "pub enum definition" | ||||
| 	pub enum ${1:Name} { | ||||
| 		${2}, | ||||
| 	} | ||||
| # Traits | ||||
| snippet trait "Trait definition" | ||||
| 	trait ${1:Name} { | ||||
| @ -186,11 +197,6 @@ snippet spawn "spawn a thread" | ||||
| 	}); | ||||
| snippet chan "Declare (Sender, Receiver) pair of asynchronous channel()" | ||||
| 	let (${1:tx}, ${2:rx}): (Sender<${3:i32}>, Receiver<${4:i32}>) = channel(); | ||||
| # Testing | ||||
| snippet as "assert!" | ||||
| 	assert!(${1:predicate}); | ||||
| snippet ase "assert_eq!" | ||||
| 	assert_eq!(${1:expected}, ${2:actual}); | ||||
| # Implementations | ||||
| snippet asref "AsRef trait implementation" | ||||
| 	impl AsRef<${1:Ref}> for ${2:Type} { | ||||
| @ -204,3 +210,19 @@ snippet asmut "AsMut trait implementation" | ||||
| 			&mut self.${0:field} | ||||
| 		} | ||||
| 	} | ||||
| snippet fd "Struct field definition" w | ||||
| 	${1:name}: ${2:Type}, | ||||
| snippet || "Closure, anonymous function (inline)" i | ||||
| 	${1:move }|$2| { $3 } | ||||
| snippet |} "Closure, anonymous function (block)" i | ||||
| 	${1:move }|$2| { | ||||
| 		$3 | ||||
| 	} | ||||
| snippet macro "macro_rules!" b | ||||
| 	macro_rules! ${1:name} { | ||||
| 		(${2:matcher}) => ( | ||||
| 			$3 | ||||
| 		) | ||||
| 	} | ||||
| snippet box "Box::new()" | ||||
| 	Box::new(${0:${VISUAL}}) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Amir Salihefendic
					Amir Salihefendic