mirror of
https://github.com/amix/vimrc
synced 2025-07-13 23:05:01 +08:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
324
sources_non_forked/vim-snippets/UltiSnips/ada.snippets
Normal file
324
sources_non_forked/vim-snippets/UltiSnips/ada.snippets
Normal file
@ -0,0 +1,324 @@
|
||||
priority -50
|
||||
|
||||
global !p
|
||||
|
||||
def ada_case(word):
|
||||
out = word[0].upper()
|
||||
for i in range(1, len(word)):
|
||||
if word[i - 1] == '_':
|
||||
out = out + word[i].upper()
|
||||
else:
|
||||
out = out + word[i]
|
||||
return out
|
||||
|
||||
def get_year():
|
||||
import time
|
||||
return time.strftime("%Y")
|
||||
|
||||
endglobal
|
||||
|
||||
snippet wi "with"
|
||||
with $1;$0
|
||||
endsnippet
|
||||
|
||||
snippet pac "package"
|
||||
package ${1:`!p snip.rv = ada_case(snip.basename)`} is
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet pacb "package body"
|
||||
package body ${1:`!p snip.rv = ada_case(snip.basename)`} is
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet ent "entry ... when"
|
||||
entry $1($2) when $3 is
|
||||
begin
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet task "task"
|
||||
task $1 is
|
||||
entry $0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet taskb "task body"
|
||||
task body $1 is
|
||||
$2
|
||||
begin
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet acc "accept"
|
||||
accept $1($2) do
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet prot "protected type"
|
||||
protected type $1($2) is
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet prob "protected body"
|
||||
protected body $1 is
|
||||
$2
|
||||
begin
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet gen "generic type"
|
||||
generic
|
||||
type $1 is $2;$0
|
||||
endsnippet
|
||||
|
||||
snippet ty "type"
|
||||
type $1 is $2;$0
|
||||
endsnippet
|
||||
|
||||
snippet tyd "type with default value"
|
||||
type $1 is $2
|
||||
with Default_Value => $3;$0
|
||||
endsnippet
|
||||
|
||||
snippet subty "subtype"
|
||||
subtype $1 is $2;$0
|
||||
endsnippet
|
||||
|
||||
snippet dec "declare block"
|
||||
declare
|
||||
$1
|
||||
begin
|
||||
$0
|
||||
end;
|
||||
endsnippet
|
||||
|
||||
snippet decn "declare named block"
|
||||
$1:
|
||||
declare
|
||||
$2
|
||||
begin
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet ifex "if expression"
|
||||
if $1 then $2 else $0
|
||||
endsnippet
|
||||
|
||||
snippet casex "case expression"
|
||||
case $1 is
|
||||
when $2 => $3,$0
|
||||
endsnippet
|
||||
|
||||
snippet fora "for all"
|
||||
for all $1 ${2:in} $3 => $0
|
||||
endsnippet
|
||||
|
||||
snippet fors "for some"
|
||||
for some $1 ${2:in} $3 => $0
|
||||
endsnippet
|
||||
|
||||
snippet if "if"
|
||||
if $1 then
|
||||
$0
|
||||
end if;
|
||||
endsnippet
|
||||
|
||||
snippet ife "if ... else"
|
||||
if $1 then
|
||||
$2
|
||||
else
|
||||
$0
|
||||
end if;
|
||||
endsnippet
|
||||
|
||||
snippet el "else"
|
||||
else
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet eif "elsif"
|
||||
elsif $1 then
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet wh "while"
|
||||
while $1 loop
|
||||
$0
|
||||
end loop;
|
||||
endsnippet
|
||||
|
||||
snippet nwh "named while"
|
||||
$1:
|
||||
while $2 loop
|
||||
$0
|
||||
end loop $1;
|
||||
endsnippet
|
||||
|
||||
snippet for "for"
|
||||
for ${1:I} in $2 loop
|
||||
$0
|
||||
end loop;
|
||||
endsnippet
|
||||
|
||||
snippet fore "for each"
|
||||
for $1 of $2 loop
|
||||
$0
|
||||
end loop;
|
||||
endsnippet
|
||||
|
||||
snippet nfor "named for"
|
||||
$1:
|
||||
for ${2:I} in $3 loop
|
||||
$0
|
||||
end loop $1;
|
||||
endsnippet
|
||||
|
||||
snippet nfore "named for each"
|
||||
$1:
|
||||
for $2 of $3 loop
|
||||
$0
|
||||
end loop $1;
|
||||
endsnippet
|
||||
|
||||
snippet proc "procedure"
|
||||
procedure $1($2) is
|
||||
$3
|
||||
begin
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet procd "procedure declaration"
|
||||
procedure $1;$0
|
||||
endsnippet
|
||||
|
||||
snippet fun "function"
|
||||
function $1($2) return $3 is
|
||||
$4
|
||||
begin
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet fune "expression function"
|
||||
function $1 return $2 is
|
||||
($3);$0
|
||||
endsnippet
|
||||
|
||||
snippet fund "function declaration"
|
||||
function $1 return $2;$0
|
||||
endsnippet
|
||||
|
||||
snippet ret "extended return"
|
||||
return $1 do
|
||||
$0
|
||||
end return;
|
||||
endsnippet
|
||||
|
||||
snippet rec "record"
|
||||
record
|
||||
$0
|
||||
end record;
|
||||
endsnippet
|
||||
|
||||
snippet case "case"
|
||||
case $1 is
|
||||
when $2 => $3;$0
|
||||
end case;
|
||||
endsnippet
|
||||
|
||||
snippet whe "when"
|
||||
when $1 => $2;$0
|
||||
endsnippet
|
||||
|
||||
snippet wheo "when others"
|
||||
when others => $1;$0
|
||||
endsnippet
|
||||
|
||||
snippet lo "loop"
|
||||
loop
|
||||
$0
|
||||
end loop;
|
||||
endsnippet
|
||||
|
||||
snippet nlo "named loop"
|
||||
$1:
|
||||
loop
|
||||
$0
|
||||
end loop $1;
|
||||
endsnippet
|
||||
|
||||
snippet ex "exit when"
|
||||
exit when $1;$0
|
||||
endsnippet
|
||||
|
||||
snippet put "Ada.Text_IO.Put"
|
||||
Ada.Text_IO.Put($1);$0
|
||||
endsnippet
|
||||
|
||||
snippet putl "Ada.Text_IO.Put_Line"
|
||||
Ada.Text_IO.Put_Line($1);$0
|
||||
endsnippet
|
||||
|
||||
snippet get "Ada.Text_IO.Get"
|
||||
Ada.Text_IO.Get($1);$0
|
||||
endsnippet
|
||||
|
||||
snippet getl "Ada.Text_IO.Get_Line"
|
||||
Ada.Text_IO.Get_Line($1);$0
|
||||
endsnippet
|
||||
|
||||
snippet newline "Ada.Text_IO.New_Line"
|
||||
Ada.Text_IO.New_Line(${1:1});$0
|
||||
endsnippet
|
||||
|
||||
snippet gpl "GPL license header"
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU ${1}General Public License as published by
|
||||
-- the Free Software Foundation; either version ${2:3} of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU $1General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU $1General Public License
|
||||
-- along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- Copyright (C) ${3:Author}, ${4:`!p snip.rv = get_year()`}
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet gplf "GPL file license header"
|
||||
-- This file is part of ${1:Program-Name}.
|
||||
--
|
||||
-- $1 is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU ${2}General Public License as published by
|
||||
-- the Free Software Foundation, either version ${3:3} of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- $1 is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU $2General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU $2General Public License
|
||||
-- along with $1. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- Copyright (C) ${4:Author}, ${5:`!p snip.rv = get_year()`}
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
@ -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
|
34
sources_non_forked/vim-snippets/UltiSnips/julia.snippets
Normal file
34
sources_non_forked/vim-snippets/UltiSnips/julia.snippets
Normal file
@ -0,0 +1,34 @@
|
||||
# Documentation
|
||||
snippet docf "function documentation" b
|
||||
#' @description
|
||||
#'
|
||||
#' ${1:function description}
|
||||
#'
|
||||
#' ${2:@param ${3:name}::${4:Type} ${5:Description}}
|
||||
#'
|
||||
#' ${6:@returns ${7:name}::${8:Type} ${9:Description}}
|
||||
#'
|
||||
#' @examples
|
||||
#'
|
||||
#' ${10: function call examples}
|
||||
endsnippet
|
||||
|
||||
snippet doct "type definition" b
|
||||
#' @description
|
||||
#'
|
||||
#' ${1:type description}
|
||||
#'
|
||||
#' ${2:@field ${3:name}::${4:Type} ${5:Description}}
|
||||
#'
|
||||
#' @examples
|
||||
#'
|
||||
#' ${10: constructor examples}
|
||||
endsnippet
|
||||
|
||||
snippet par "function parameter documentation" b
|
||||
#' @param ${1:name}::${2:Type} ${0:Description}
|
||||
endsnippet
|
||||
|
||||
snippet fld "type field documentation" b
|
||||
#' @field ${1:name}::${2:Type} ${0:Description}
|
||||
endsnippet
|
12
sources_non_forked/vim-snippets/UltiSnips/pandoc.snippets
Normal file
12
sources_non_forked/vim-snippets/UltiSnips/pandoc.snippets
Normal file
@ -0,0 +1,12 @@
|
||||
extends markdown
|
||||
|
||||
# overwrite if necessary
|
||||
priority -49
|
||||
|
||||
snippet title "Title Header" b
|
||||
% ${1:`!v Filename('', 'title')`}
|
||||
% ${2:`!v g:snips_author`}
|
||||
% ${3:`!v strftime("%d %B %Y")`}
|
||||
|
||||
$0
|
||||
endsnippet
|
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
|
177
sources_non_forked/vim-snippets/UltiSnips/r.snippets
Normal file
177
sources_non_forked/vim-snippets/UltiSnips/r.snippets
Normal file
@ -0,0 +1,177 @@
|
||||
priority -50
|
||||
|
||||
global !p
|
||||
import os
|
||||
from vimsnippets import complete
|
||||
|
||||
FIELD_TYPES = [
|
||||
'character',
|
||||
'data.frame',
|
||||
'integer',
|
||||
'list',
|
||||
'logical',
|
||||
'matrix',
|
||||
'numeric',
|
||||
'vector']
|
||||
endglobal
|
||||
|
||||
snippet #! "Hashbang for Rscript (#!)" b
|
||||
#!/usr/bin/env Rscript
|
||||
endsnippet
|
||||
|
||||
snippet setwd "Set workingdir" b
|
||||
setwd("${1:`!p snip.rv = os.getcwd()`}")
|
||||
endsnippet
|
||||
|
||||
snippet as "Apply type on variable" w
|
||||
as.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`(${2}${VISUAL})
|
||||
endsnippet
|
||||
|
||||
snippet is "Test type on variable" w
|
||||
is.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`(${2}${VISUAL})
|
||||
endsnippet
|
||||
|
||||
snippet dl "Download and install a package" b
|
||||
download.file("${1:${VISUAL:url to package}}", destfile = "${2:${1/.*\/(\S*)$/(?1:$1)/ga}}")
|
||||
install.packages("$2", type = "source", repos = NULL)
|
||||
library("${3:${2/^(\w+)_.*$/(?1:$1)/ga}}")
|
||||
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"
|
||||
sapply(${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
|
252
sources_non_forked/vim-snippets/UltiSnips/rust.snippets
Normal file
252
sources_non_forked/vim-snippets/UltiSnips/rust.snippets
Normal file
@ -0,0 +1,252 @@
|
||||
#######################################################################
|
||||
# Rust Snippets #
|
||||
#######################################################################
|
||||
|
||||
priority -50
|
||||
|
||||
snippet fn "A function, optionally with arguments and return type." b
|
||||
fn ${1:function_name}(${2})${3/..*/ -> /}${3} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet test "Test function" b
|
||||
#[test]
|
||||
fn ${1:test_function_name}() {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet bench "Bench function" b
|
||||
#[bench]
|
||||
fn ${1:bench_function_name}(b: &mut test::Bencher) {
|
||||
b.iter(|| {
|
||||
${VISUAL}${0}
|
||||
})
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet new "A new function" b
|
||||
pub fn new(${2}) -> ${1:Name} {
|
||||
${VISUAL}${0}return $1 { ${3} };
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet main "The main function" b
|
||||
pub fn main() {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet let "A let statement" b
|
||||
let ${1:name}${3} = ${VISUAL}${2};
|
||||
endsnippet
|
||||
|
||||
snippet lmut "let mut = .." b
|
||||
let mut ${1:name}${3} = ${VISUAL}${2};
|
||||
endsnippet
|
||||
|
||||
snippet pri "print!(..)" b
|
||||
print!("${1}"${2/..*/, /}${2});
|
||||
endsnippet
|
||||
|
||||
snippet pln "println!(..)" b
|
||||
println!("${1}"${2/..*/, /}${2});
|
||||
endsnippet
|
||||
|
||||
snippet fmt "format!(..)"
|
||||
format!("${1}"${2/..*/, /}${2});
|
||||
endsnippet
|
||||
|
||||
snippet macro "macro_rules!" b
|
||||
macro_rules! ${1:name} (
|
||||
(${2:matcher}) => (
|
||||
${3}
|
||||
)
|
||||
)
|
||||
endsnippet
|
||||
|
||||
snippet ec "extern crate ..." b
|
||||
extern crate ${1:sync};
|
||||
endsnippet
|
||||
|
||||
snippet ecl "...extern crate log;" b
|
||||
#![feature(phase)]
|
||||
#[phase(plugin, link)] extern crate log;
|
||||
endsnippet
|
||||
|
||||
snippet mod "A module" b
|
||||
mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet crate "Create header information" b
|
||||
// Crate name
|
||||
#![crate_name = "${1:crate_name}"]
|
||||
|
||||
// Additional metadata attributes
|
||||
#![desc = "${2:Descrption.}"]
|
||||
#![license = "${3:BSD}"]
|
||||
#![comment = "${4:Comment.}"]
|
||||
|
||||
// Specify the output type
|
||||
#![crate_type = "${5:lib}"]
|
||||
endsnippet
|
||||
|
||||
snippet allow "#[allow(..)]" b
|
||||
#[allow(${1:unused_variable})]
|
||||
endsnippet
|
||||
|
||||
snippet feat "#![feature(..)]" b
|
||||
#![feature(${1:macro_rules})]
|
||||
endsnippet
|
||||
|
||||
snippet der "#[deriving(..)]" b
|
||||
#[deriving(${1:Show})]
|
||||
endsnippet
|
||||
|
||||
snippet attr "#[..]" b
|
||||
#[${1:inline}]
|
||||
endsnippet
|
||||
|
||||
snippet opt "Option<..>"
|
||||
Option<${1:int}>
|
||||
endsnippet
|
||||
|
||||
snippet res "Result<.., ..>"
|
||||
Result<${1:int}, ${2:()}>
|
||||
endsnippet
|
||||
|
||||
snippet if "if .. (if)" b
|
||||
if ${1} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet el "else .. (el)"
|
||||
else {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet eli "else if .. (eli)"
|
||||
else if ${1} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ife "if .. else (ife)"
|
||||
if ${1} {
|
||||
${2}
|
||||
} else {
|
||||
${3}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet mat "match"
|
||||
match ${1} {
|
||||
${2} => ${3},
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet loop "loop {}" b
|
||||
loop {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet while "while .. {}" b
|
||||
while ${1} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "for .. in .." b
|
||||
for ${1:i} in ${2:range(0u, 10)} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet spawn "spawn(proc() { .. });" b
|
||||
spawn(proc() {
|
||||
${VISUAL}${0}
|
||||
});
|
||||
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
|
||||
|
||||
snippet todo "A Todo comment"
|
||||
// [TODO]: ${1:Description} - `!v strftime("%Y-%m-%d %I:%M%P")`
|
||||
endsnippet
|
||||
|
||||
snippet fixme "FIXME comment"
|
||||
// FIXME: ${1}
|
||||
endsnippet
|
||||
|
||||
snippet st "Struct" b
|
||||
struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet stn "Struct with new constructor." b
|
||||
pub struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
|
||||
${3}
|
||||
}
|
||||
|
||||
impl $1 {
|
||||
pub fn new(${2}) -> $1 {
|
||||
${4}return $1 {
|
||||
${5}
|
||||
};
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet enum "An enum" b
|
||||
enum ${1:Name} {
|
||||
${VISUAL}${0},
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet type "A type" b
|
||||
type ${1:NewName} = ${VISUAL}${0};
|
||||
endsnippet
|
||||
|
||||
snippet imp "An impl" b
|
||||
impl ${1:Name} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet drop "Drop implementation" b
|
||||
impl Drop for ${1:Name} {
|
||||
fn drop(&mut self) {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet trait "Trait definition" b
|
||||
trait ${1:Name} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
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