2014-04-18 12:58:02 +00:00
|
|
|
#######################################################################
|
|
|
|
# Rust Snippets #
|
|
|
|
#######################################################################
|
|
|
|
|
2014-07-02 11:18:18 +00:00
|
|
|
priority -50
|
|
|
|
|
|
|
|
snippet fn "A function, optionally with arguments and return type." b
|
2014-04-18 12:58:02 +00:00
|
|
|
fn ${1:function_name}(${2})${3/..*/ -> /}${3} {
|
2014-07-02 11:18:18 +00:00
|
|
|
${VISUAL}${0}
|
2014-04-18 12:58:02 +00:00
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2014-07-02 11:18:18 +00:00
|
|
|
snippet pri "print!(..)" b
|
|
|
|
print!("${1}"${2/..*/, /}${2});
|
2014-04-18 12:58:02 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet pln "println!(..)" b
|
|
|
|
println!("${1}"${2/..*/, /}${2});
|
|
|
|
endsnippet
|
|
|
|
|
2014-07-02 11:18:18 +00:00
|
|
|
snippet fmt "format!(..)"
|
|
|
|
format!("${1}"${2/..*/, /}${2});
|
|
|
|
endsnippet
|
2014-04-18 12:58:02 +00:00
|
|
|
|
2014-07-02 11:18:18 +00:00
|
|
|
snippet macro "macro_rules!" b
|
|
|
|
macro_rules! ${1:name} (
|
|
|
|
(${2:matcher}) => (
|
|
|
|
${3}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
endsnippet
|
2014-04-18 12:58:02 +00:00
|
|
|
|
2014-07-02 11:18:18 +00:00
|
|
|
snippet mod "A module" b
|
2014-04-18 12:58:02 +00:00
|
|
|
mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} {
|
2014-07-02 11:18:18 +00:00
|
|
|
${VISUAL}${0}
|
|
|
|
}
|
2014-04-18 12:58:02 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet for "for .. in .." b
|
2015-01-18 12:58:28 +00:00
|
|
|
for ${1:i} in ${2:${3:0us}..${4:10}} {
|
2014-07-02 11:18:18 +00:00
|
|
|
${VISUAL}${0}
|
2014-04-18 12:58:02 +00:00
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet todo "A Todo comment"
|
|
|
|
// [TODO]: ${1:Description} - `!v strftime("%Y-%m-%d %I:%M%P")`
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet st "Struct" b
|
2014-07-02 11:18:18 +00:00
|
|
|
struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
|
|
|
|
${VISUAL}${0}
|
2014-04-18 12:58:02 +00:00
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet stn "Struct with new constructor." b
|
2014-07-02 11:18:18 +00:00
|
|
|
pub struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
|
|
|
|
${3}
|
2014-04-18 12:58:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl $1 {
|
|
|
|
pub fn new(${2}) -> $1 {
|
|
|
|
${4}return $1 {
|
|
|
|
${5}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
# vim:ft=snippets:
|