mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -4,12 +4,34 @@
|
||||
|
||||
priority -50
|
||||
|
||||
snippet fn "A function, optionally with arguments and return type." b
|
||||
snippet let "let variable declaration" b
|
||||
let ${1:name}${2:: ${3:type}} = ${4};
|
||||
endsnippet
|
||||
|
||||
snippet letm "let mut variable declaration" b
|
||||
let mut ${1:name}${2:: ${3:type}} = ${4};
|
||||
endsnippet
|
||||
|
||||
snippet fn "A function, optionally with arguments and return type."
|
||||
fn ${1:function_name}(${2})${3/..*/ -> /}${3} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet arg "Function Arguments" i
|
||||
${1:a}: ${2:T}${3:, arg}
|
||||
endsnippet
|
||||
|
||||
snippet || "Closure, anonymous function (inline)" i
|
||||
${1:move }|${2}| { $3 }
|
||||
endsnippet
|
||||
|
||||
snippet |} "Closure, anonymous function (block)" i
|
||||
${1:move }|${2}| {
|
||||
$3
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet pri "print!(..)" b
|
||||
print!("${1}"${2/..*/, /}${2});
|
||||
endsnippet
|
||||
@ -30,7 +52,7 @@ macro_rules! ${1:name} (
|
||||
)
|
||||
endsnippet
|
||||
|
||||
snippet mod "A module" b
|
||||
snippet mod "A module" b
|
||||
mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
@ -52,18 +74,27 @@ struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# TODO: fancy dynamic field mirroring like Python slotclass
|
||||
snippet stn "Struct with new constructor." b
|
||||
pub struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
|
||||
${3}
|
||||
fd${0}
|
||||
}
|
||||
|
||||
impl $1 {
|
||||
pub fn new(${2}) -> $1 {
|
||||
${4}return $1 {
|
||||
${5}
|
||||
};
|
||||
$1 { ${3} };
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fd "Struct field definition" w
|
||||
${1:name}: ${2:Type},
|
||||
endsnippet
|
||||
|
||||
snippet impl "Struct/Trait implementation" b
|
||||
impl ${1:Type/Trait}${2: for ${3:Type}} {
|
||||
${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
Reference in New Issue
Block a user