1
0
mirror of https://github.com/amix/vimrc synced 2025-07-13 14:55:01 +08:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Mirosław Pragłowski
2014-10-13 21:54:40 +02:00
266 changed files with 11284 additions and 3954 deletions

View File

@ -0,0 +1 @@
*.pyc

View 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:

View File

@ -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

View 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

View 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

View 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

View 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

View File

@ -0,0 +1,3 @@
priority -50
extends tex, r

View 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:

View 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

View File

@ -0,0 +1,37 @@
if exists("b:done_vimsnippets")
finish
endif
let b:done_vimsnippets = 1
" Expanding the path is not needed on Vim 7.4
if &cp || version >= 704
finish
endif
" Add pythonx to the python search path if needed (i.e. <= Vim 7.3).
if !has("python") && !has("python3")
finish
end
" This will fail if UltiSnips is not installed.
try
call UltiSnips#bootstrap#Bootstrap()
catch /E117/
finish
endtry
" This should have been set by UltiSnips, otherwise something is wrong.
if !exists("g:_uspy")
finish
end
" Expand our path
let s:SourcedFile=expand("<sfile>")
exec g:_uspy "import vim, os, sys"
exec g:_uspy "sourced_file = vim.eval('s:SourcedFile')"
exec g:_uspy "while not os.path.exists(os.path.join(sourced_file, 'pythonx')):
\ sourced_file = os.path.dirname(sourced_file)"
exec g:_uspy "module_path = os.path.join(sourced_file, 'pythonx')"
exec g:_uspy "sys.path.append(module_path)"

View File

@ -0,0 +1,20 @@
"""Helper methods used in UltiSnips snippets."""
def complete(tab, opts):
"""
get options that start with tab
:param tab: query string
:param opts: list that needs to be completed
:return: a string that start with tab
"""
msg = "({0})"
if tab:
opts = [m[len(tab):] for m in opts if m.startswith(tab)]
if len(opts) == 1:
return opts[0]
if not len(opts):
msg = "{0}"
return msg.format("|".join(opts))

View File

@ -0,0 +1,255 @@
snippet wi with
with ${1};${0}
snippet pac package
package ${1} is
${0}
end $1;
snippet pacb package body
package body ${1} is
${0}
end $1;
snippet ent entry ... when
entry ${1}(${2}) when ${3} is
begin
${0}
end $1;
snippet task task
task ${1} is
entry ${0}
end $1;
snippet taskb task body
task body ${1} is
${2}
begin
${0}
end $1;
snippet acc accept
accept ${1}(${2}) do
${0}
end $1;
snippet prot protected type
protected type ${1}(${2}) is
${0}
end $1;
snippet prob protected body
protected body ${1} is
${2}
begin
${0}
end $1;
snippet gen generic type
generic
type ${1} is ${2};${0}
snippet ty type
type ${1} is ${2};${0}
snippet tyd type with default value
type ${1} is ${2}
with Default_Value => ${3};${0}
snippet subty subtype
subtype ${1} is ${2};${0}
snippet dec declare block
declare
${1}
begin
${0}
end;
snippet decn declare named block
${1}:
declare
${2}
begin
${0}
end $1;
snippet ifex if expression
if ${1} then ${2} else ${0}
snippet casex case expression
case ${1} is
when ${2} => ${3},${0}
snippet fora for all
for all ${1} ${2:in} ${3} => ${0}
snippet fors for some
for some ${1} ${2:in} ${3} => ${0}
snippet if if
if ${1} then
${0}
end if;
snippet ife if ... else
if ${1} then
${2}
else
${0}
end if;
snippet el else
else
${0}
snippet eif elsif
elsif ${1} then
${0}
snippet wh while
while ${1} loop
${0}
end loop;
snippet nwh named while
${1}:
while ${2} loop
${0}
end loop $1;
snippet for for
for ${1:I} in ${2} loop
${0}
end loop;
snippet fore for each
for ${1} of ${2} loop
${0}
end loop;
snippet nfor named for
${1}:
for ${2:I} in ${3} loop
${0}
end loop $1;
snippet nfore named for each
${1}:
for ${2} of ${3} loop
${0}
end loop $1;
snippet proc procedure
procedure ${1}(${2}) is
${3}
begin
${0}
end $1;
snippet procd procedure declaration
procedure ${1};${0}
snippet fun function
function ${1}(${2}) return ${3} is
${4}
begin
${0}
end $1;
snippet fune expression function
function ${1} return ${2} is
(${3});${0}
snippet fund function declaration
function ${1} return ${2};${0}
snippet ret extended return
return ${1} do
${0}
end return;
snippet rec record
record
${0}
end record;
snippet case case
case ${1} is
when ${2} => ${3};${0}
end case;
snippet whe when
when ${1} => ${2};${0}
snippet wheo when others
when others => ${1};${0}
snippet lo loop
loop
${0}
end loop;
snippet nlo named loop
${1}:
loop
${0}
end loop $1;
snippet ex exit when
exit when ${1};${0}
snippet put Ada.Text_IO.Put
Ada.Text_IO.Put(${1});${0}
snippet putl Ada.Text_IO.Put_Line
Ada.Text_IO.Put_Line(${1});${0}
snippet get Ada.Text_IO.Get
Ada.Text_IO.Get(${1});${0}
snippet getl Ada.Text_IO.Get_Line
Ada.Text_IO.Get_Line(${1});${0}
snippet newline Ada.Text_IO.New_Line
Ada.Text_IO.New_Line(${1:1});${0}
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:`strftime("%Y")`}
${0}
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:`strftime("%Y")`}
${0}

View File

@ -0,0 +1,11 @@
snippet def
define ["${1:#dependencies1}"], (${2:#dependencies2}) ->
${0:TARGET}
snippet defn
define "${1:#name}", ["${2:#dependencies1}"], (${3:#dependencies2}) ->
${0:TARGET}
snippet reqjs
require ["${1:#dependencies1}"], (${2:#dependencies2}) ->
${0:TARGET}

View File

@ -0,0 +1,338 @@
### Import
snippet imp
import
snippet pimp
public import
### My favorite modules
snippet io
std.stdio
snippet traits
std.traits
snippet conv
std.conv
snippet arr
std.array
snippet algo
std.algorithm
snippet theusual
import std.stdio, std.string, std.array;
import std.traits, std.conv, std.algorithm;
import std.math, std.regex;
### Control Structures
snippet for
for(int ${1:i} = 0; $1 < ${2:count}; $1++) {
${0}
}
snippet fe
foreach(${1:elem}; ${2:range}) {
${0}
}
snippet fei
foreach(${1:i}, ${2:elem}; ${3:range}) {
${0}
}
snippet fer
foreach_reverse(${1:elem}; ${2:range}) {
${0}
}
snippet feri
foreach_reverse(${1:i}, ${2:elem}; ${3:range}) {
${0}
}
snippet sce
scope(exit) ${1:f.close();}
snippet scs
scope(success) ${1}
snippet scf
scope(failure) ${1}
snippet el
else {
${1}
}
snippet eif
else if(${1}) {
${0}
}
snippet if
if(${1}) {
${0}
}
snippet ife
if(${1}) {
${2}
} else {
${3}
}
snippet ifee
if(${1}) {
${2}
} else if(${3}) {
${4}
} else {
${5}
}
snippet sw
switch(${1}) {
${0}
}
snippet cs
case ${1:0}:
${2}
break;
snippet def
default:
${0}
snippet fsw
final switch(${1}) {
${0}
}
snippet try
try {
${1}
} catch(${2:Exception} ${3:e}) {
${4}
}
snippet tcf
try {
${0}
} catch(${1:Exception} ${2:e}) {
${3}
} finally {
${4}
}
snippet wh
while(${1:cond}) {
${0}
}
snippet dowh
do {
${1}
} while(${2});
snippet sif
static if(${1:cond}) {
${2}
}
snippet sife
static if(${1}) {
${2}
} else {
${3}
}
snippet sifee
static if(${1}) {
${2}
} else static if(${3}) {
${4}
} else {
${5}
}
snippet seif
else static if(${1}) {
${2}
}
snippet ?
(${1: a > b}) ? ${2:a} : ${3:b};
snippet with
with(${1:exp}) {
${2}
} ${0}
### Functions
snippet fun
${1:auto} ${2:func}(${3:params}) {
${0}
}
snippet contr
in {
${1}
} out {
${2}
} body {
${0}
}
snippet l
(${1:x}) => ${2:x}${0:;}
snippet funl
function (${1:int x}) => ${2}${3:;}
snippet del
delegate (${1:int x}) => ${2}${3:;}
### Templates
snippet temp
template ${1:`vim_snippets#Filename("$2", "untitled")`}(${2:T}) {
${0}
}
snippet tempif
template ${1:`vim_snippets#Filename("$2", "untitled")`}(${2:T}) if(${3:isSomeString!}$2) {
${0}
}
snippet opApply
int opApply(Dg)(Dg dg) if(ParameterTypeTuble!Dg.length == 2) {
${0}
}
snippet psn
pure @safe nothrow
snippet safe
@safe
snippet trusted
@trusted
snippet system
@system
### OOPs
snippet cl
class${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} {
${0}
}
snippet str
struct${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} {
${0}
}
snippet uni
union${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} {
${0}
}
snippet inter
interface I${1:`vim_snippets#Filename("$2", "untitled")`} {
${0}
}
snippet enum
enum ${1} {
${0}
}
snippet pu
public
snippet pr
private
snippet po
protected
snippet ctor
this(${1}) {
${0}
}
snippet dtor
~this(${1}) {
${0}
}
### Type Witchery
snippet al
alias ${1:b} = ${2:a};
${0}
snippet alth
alias ${1:value} this;
${0}
### The Commonplace
snippet main
void main() {
${0}
}
snippet maina
void main(string[] args) {
${0}
}
snippet mod
module ${1:main};${0}
snippet var
${1:auto} ${2:var} = ${0:1};
snippet new
${1:auto} ${2:var} = new ${3:Object}(${4});
${0}
snippet file
auto ${1:f} = File(${2:"useful_info.xml"}, ${3:"rw"});
${0}
snippet map
map!(${1:f})(${2:xs});
${0}
snippet filter
filter!(${1:p})(${2:xs});
${0}
snippet reduce
reduce!(${1:f})(${2:xs});
${0}
snippet find
find!(${1:p})($2:xs);
${0}
snippet aa
${1:int}[${2:string}] ${3:dict} = ${0};
### Misc
snippet #!
#!/usr/bin/env rdmd
snippet bang
#!/usr/bin/env rdmd
snippet rdmd
#!/usr/bin/env rdmd
snippet isstr
isSomeString!${1:S}
snippet isnum
isNumeric!${1:N}
snippet tos
to!string(${1:x});
${0}
snippet toi
to!int(${1:str});
${0}
snippet tod
to!double(${1:str});
${0}
snippet un
unittest {
${0}
}
snippet ver
version(${1:Posix}) {
${0}
}
snippet de
debug {
${0}
}
snippet sst
shared static this(${1}) {
${0}
}
snippet td
// Typedef is deprecated. Use alias instead.
typedef
snippet ino
inout
snippet imm
immutable
snippet fin
final
snippet con
const
snippet psi
private static immutable ${1:int} ${2:Constant} = ${3:1};
${0}
snippet prag
pragma(${1})
snippet pms
pragma(msg, ${1:Warning});
snippet asm
asm {
${1}
}
snippet mixin
mixin(${1:`writeln("Hello, World!");`});
snippet over
override
snippet ret
return ${1};
snippet FILE
__FILE__
snippet MOD
__MODULE__
snippet LINE
__LINE__
snippet FUN
__FUNCTION__
snippet PF
__PRETTY_FUNCTION__
snippet cast
cast(${1:T})(${2:val});
snippet /*
/*
* ${1}
*/
### Fun stuff
snippet idk
// I don't know how this works. Don't touch it.
snippet idfk
// Don't FUCKING touch this.

View File

@ -0,0 +1,18 @@
# Angular HTML
snippet rep
div(ng-repeat='${1} in ${2}')
snippet repf
div(ng-repeat='${1} in ${2}' | ${3})
snippet repi
div(ng-repeat='${1} in ${2}' track by $index)
snippet hide
div(ng-hide='${1}')
snippet show
div(ng-show='${1}')
snippet if
div(ng-if='${1}')

View File

@ -0,0 +1,14 @@
snippet def
define(["${1:#dependencies1}"], function (${2:#dependencies2}) {
return ${0:TARGET};
});
snippet defn
define("${1:#name}", ["${2:#dependencies1}"], function (${3:#dependencies2}) {
return ${0:TARGET};
});
snippet reqjs
require(["${1:#dependencies1}"], function (${2:#dependencies2}) {
return ${0:TARGET};
});

View File

@ -0,0 +1,50 @@
# module exports
snippet ex
module.exports = ${1};
# require
snippet re
var ${1} = require("${2:module_name}");
# EventEmitter
snippet on
on('${1:event_name}', function(${2:stream}) {
${3}
});
snippet emit
emit('${1:event_name}', ${2:args});
snippet once
once('${1:event_name}', function(${2:stream}) {
${3}
});
# http. User js function snippet as handler
snippet http
http.createServer(${1:handler}).listen(${2:port_number});
# net
snippet net
net.createServer(function(${1:socket}){
${1}.on('data', function('data'){
${2}
]});
${1}.on('end', function(){
${3}
});
}).listen(${4:8124});
# Stream snippets
snippet pipe
pipe(${1:stream})${2}
# Express snippets
snippet eget
${1:app}.get('${2:route}', ${3:handler});
snippet epost
${1:app}.post('${2:route}', ${3:handler});
snippet eput
${1:app}.put('${2:route}', ${3:handler});
snippet edel
${1:app}.delete('${2:route}', ${3:handler});
# process snippets
snippet stdin
process.stdin
snippet stdout
process.stdout
snippet stderr
process.stderr

View File

@ -0,0 +1,102 @@
snippet #!
#!/usr/bin/env julia
# Functions
snippet fun function definition
function ${1}(${2})
${0}
end
snippet ret return
return(${0})
# Printing to console
snippet pr print
print("${1}")
${0}
snippet prl print line
println("${1}")
${0}
# Includes
snippet use load a package
using ${0}
snippet incl include source code
include("${1}")
${0}
# Loops
snippet forc for loop iterating over iterable container
for ${1} in ${2}
${0}
end
snippet for standard for loop
for ${1} = ${2}
${0}
end
snippet fornest nested for loop
for ${1} = ${2}, ${3} = ${4}
${0}
end
snippet wh while loop
while ${1} ${2:<=} ${3}
${0}
end
# Conditionals
snippet if if statement
if ${1}
${0}
end
snippet el else part of statement
else
${0}
snippet eif else if part of if statement
else if ${1}
${0}
snippet ife full if-else statement
if ${1}
${2}
else
${0}
end
snippet tern ternary operator
${1} ? ${2} : ${3:nothing}
# Exceptions
snippet try try catch
try
${1}
catch ${2}
${0}
end
snippet fin finally statement
finally
${0}
snippet thr throw
throw(${1})
${0}
# Messages
snippet in
info("${1}")
${0}
snippet wa
warn("${1}")
${0}
snippet err
error("${1}")
${0}

View File

@ -0,0 +1,486 @@
snippet art
assert_redirected_to ${1:action}: '${2:index}'
snippet artnp
assert_redirected_to ${1:parent}_${2:child}_path(${3:@$1}, ${0:@$2})
snippet artnpp
assert_redirected_to ${1:parent}_${2:child}_path(${0:@$1})
snippet artp
assert_redirected_to ${1:model}_path(${0:@$1})
snippet artpp
assert_redirected_to ${0:model}s_path
snippet asd
assert_difference '${1:Model}.${2:count}', ${3:1} do
${0}
end
snippet asnd
assert_no_difference '${1:Model}.${2:count}' do
${0}
end
snippet asre
assert_response :${1:success}, @response.body
snippet asrj
assert_rjs :${1:replace}, '${0:dom id}'
snippet ass assert_select(..)
assert_select '${1:path}', ${2:text}: '${3:inner_html}' ${4:do}
${0}
end
snippet ba
before_action :${0:method}
snippet bf
before_filter :${0:method}
snippet bt
belongs_to :${0:association}
snippet btp
belongs_to :${1:association}, polymorphic: true
snippet crw
cattr_accessor :${0:attr_names}
snippet defcreate
def create
@${1:model_class_name} = ${2:ModelClassName}.new(params[:$1])
respond_to do |format|
if @$1.save
flash[:notice] = '$2 was successfully created.'
format.html { redirect_to(@$1) }
format.xml { render xml: @$1, status: :created, location: @$1 }
else
format.html { render action: 'new' }
format.xml { render xml: @$1.errors, status: :unprocessable_entity }
end
end
end
snippet defdestroy
def destroy
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
@$1.destroy
respond_to do |format|
format.html { redirect_to($1s_url) }
format.xml { head :ok }
end
end
snippet defedit
def edit
@${1:model_class_name} = ${0:ModelClassName}.find(params[:id])
end
snippet defindex
def index
@${1:model_class_name} = ${2:ModelClassName}.all
respond_to do |format|
format.html # index.html.erb
format.xml { render xml: @$1s }
end
end
snippet defnew
def new
@${1:model_class_name} = ${2:ModelClassName}.new
respond_to do |format|
format.html # new.html.erb
format.xml { render xml: @$1 }
end
end
snippet defshow
def show
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render xml: @$1 }
end
end
snippet defupdate
def update
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
respond_to do |format|
if @$1.update_attributes(params[:$1])
flash[:notice] = '$2 was successfully updated.'
format.html { redirect_to(@$1) }
format.xml { head :ok }
else
format.html { render action: 'edit' }
format.xml { render xml: @$1.errors, status: :unprocessable_entity }
end
end
end
snippet dele delegate .. to
delegate :${1:methods}, to: :${0:object}
snippet dele delegate .. to .. prefix .. allow_nil
delegate :${1:methods}, to: :${2:object}, prefix: :${3:prefix}, allow_nil: ${0:allow_nil}
snippet amc
alias_method_chain :${1:method_name}, :${0:feature}
snippet flash
flash[:${1:notice}] = '${0}'
snippet habtm
has_and_belongs_to_many :${1:object}, join_table: '${2:table_name}', foreign_key: '${3}_id'
snippet hm
has_many :${0:object}
snippet hmd
has_many :${1:other}s, class_name: '${2:$1}', foreign_key: '${3:$1}_id', dependent: :destroy
snippet hmt
has_many :${1:object}, through: :${0:object}
snippet ho
has_one :${0:object}
snippet hod
has_one :${1:object}, dependent: :${0:destroy}
snippet i18
I18n.t('${1:type.key}')
snippet ist
<%= image_submit_tag('${1:agree.png}', id: '${2:id}'${0}) %>
snippet log
Rails.logger.${1:debug} ${0}
snippet log2
RAILS_DEFAULT_LOGGER.${1:debug} ${0}
snippet logd
logger.debug { '${1:message}' }
snippet loge
logger.error { '${1:message}' }
snippet logf
logger.fatal { '${1:message}' }
snippet logi
logger.info { '${1:message}' }
snippet logw
logger.warn { '${1:message}' }
snippet mapc
${1:map}.${2:connect} '${0:controller/:action/:id}'
snippet mapca
${1:map}.catch_all '*${2:anything}', controller: '${3:default}', action: '${4:error}'
snippet mapr
${1:map}.resource :${0:resource}
snippet maprs
${1:map}.resources :${0:resource}
snippet mapwo
${1:map}.with_options ${2:controller}: '${3:thing}' do |$3|
${0}
end
###############################
# model callback snippets #
###############################
# before callback
snippet mbv
before_validation :${0:method}
snippet mbc
before_create :${0:method}
snippet mbu
before_update :${0:method}
snippet mbs
before_save :${0:method}
snippet mbd
before_destroy :${0:method}
# after callback
snippet mav
after_validation :${0:method}
snippet maf
after_find :${0:method}
snippet mat
after_touch :${0:method}
snippet macr
after_create :${0:method}
snippet mau
after_update :${0:method}
snippet mas
after_save :${0:method}
snippet mad
after_destroy :${0:method}
# around callback
snippet marc
around_create :${0:method}
snippet maru
around_update :${0:method}
snippet mars
around_save :${0:method}
snippet mard
around_destroy :${0:method}
snippet mcht
change_table :${1:table_name} do |t|
${0}
end
snippet mp
map(&:${0:id})
snippet mrw
mattr_accessor :${0:attr_names}
snippet oa
order('${0:field}')
snippet od
order('${0:field} DESC')
snippet pa
params[:${1:id}]
snippet ra
render action: '${0:action}'
snippet ral
render action: '${1:action}', layout: '${0:layoutname}'
snippet rest
respond_to do |format|
format.${1:html} { ${0} }
end
snippet rf
render file: '${0:filepath}'
snippet rfu
render file: '${1:filepath}', use_full_path: ${0:false}
snippet ri
render inline: "${0:<%= 'hello' %>}"
snippet ril
render inline: "${1:<%= 'hello' %>}", locals: { ${2:name}: '${3:value}'${0} }
snippet rit
render inline: "${1:<%= 'hello' %>}", type: ${0::rxml}
snippet rjson
render json: '${0:text to render}'
snippet rl
render layout: '${0:layoutname}'
snippet rn
render nothing: ${0:true}
snippet rns
render nothing: ${1:true}, status: ${0:401}
snippet rp
render partial: '${0:item}'
snippet rpc
render partial: '${1:item}', collection: ${0:@$1s}
snippet rpl
render partial: '${1:item}', locals: { ${2:$1}: ${0:@$1} }
snippet rpo
render partial: '${1:item}', object: ${0:@$1}
snippet rps
render partial: '${1:item}', status: ${0:500}
snippet rt
render text: '${0:text to render}'
snippet rtl
render text: '${1:text to render}', layout: '${0:layoutname}'
snippet rtlt
render text: '${1:text to render}', layout: ${0:true}
snippet rts
render text: '${1:text to render}', status: ${0:401}
snippet ru
render :update do |${1:page}|
$1.${0}
end
snippet rxml
render xml: '${0:text to render}'
snippet sc
scope :${1:name}, -> { where(${2:field}: ${0:value}) }
snippet sl
scope :${1:name}, lambda do |${2:value}|
where('${3:field = ?}', ${0:value})
end
snippet sha1
Digest::SHA1.hexdigest(${0:string})
snippet sweeper
class ${1:ModelClassName}Sweeper < ActionController::Caching::Sweeper
observe $1
def after_save(${0:model_class_name})
expire_cache($2)
end
def after_destroy($2)
expire_cache($2)
end
def expire_cache($2)
expire_page
end
end
snippet va validates_associated
validates_associated :${0:attribute}
snippet va validates .., acceptance: true
validates :${0:terms}, acceptance: true
snippet vc
validates :${0:attribute}, confirmation: true
snippet ve
validates :${1:attribute}, exclusion: { in: ${0:%w( mov avi )} }
snippet vf
validates :${1:attribute}, format: { with: /${0:regex}/ }
snippet vi
validates :${1:attribute}, inclusion: { in: %w(${0: mov avi }) }
snippet vl
validates :${1:attribute}, length: { in: ${2:3}..${0:20} }
snippet vn
validates :${0:attribute}, numericality: true
snippet vp
validates :${0:attribute}, presence: true
snippet vu
validates :${0:attribute}, uniqueness: true
snippet format
format.${1:js|xml|html} { ${0} }
snippet wc
where(${1:'conditions'}${0:, bind_var})
snippet wf
where(${1:field}: ${0:value})
snippet xdelete
xhr :delete, :${1:destroy}, id: ${2:1}
snippet xget
xhr :get, :${1:show}, id: ${2:1}
snippet xpost
xhr :post, :${1:create}, ${2:object}: ${3:object}
snippet xput
xhr :put, :${1:update}, id: ${2:1}, ${3:object}: ${4:object}
snippet test
test 'should ${1:do something}' do
${0}
end
###########################
# migrations snippets #
###########################
snippet mac
add_column :${1:table_name}, :${2:column_name}, :${0:data_type}
snippet mai
add_index :${1:table_name}, :${0:column_name}
snippet mrc
remove_column :${1:table_name}, :${0:column_name}
snippet mrnc
rename_column :${1:table_name}, :${2:old_column_name}, :${0:new_column_name}
snippet mcc
change_column :${1:table}, :${2:column}, :${0:type}
snippet mnc
t.${1:string} :${2:title}${3:, null: false}
snippet mct
create_table :${1:table_name} do |t|
${0}
end
snippet migration class .. < ActiveRecord::Migration .. def up .. def down .. end
class ${1:class_name} < ActiveRecord::Migration
def up
${0}
end
def down
end
end
snippet migration class .. < ActiveRecord::Migration .. def change .. end
class ${1:class_name} < ActiveRecord::Migration
def change
${0}
end
end
snippet trc
t.remove :${0:column}
snippet tre
t.rename :${1:old_column_name}, :${2:new_column_name}
${0}
snippet tref
t.references :${0:model}
snippet tcb
t.boolean :${1:title}
${0}
snippet tcbi
t.binary :${1:title}, limit: ${2:2}.megabytes
${0}
snippet tcd
t.decimal :${1:title}, precision: ${2:10}, scale: ${3:2}
${0}
snippet tcda
t.date :${1:title}
${0}
snippet tcdt
t.datetime :${1:title}
${0}
snippet tcf
t.float :${1:title}
${0}
snippet tch
t.change :${1:name}, :${2:string}, ${3:limit}: ${4:80}
${0}
snippet tci
t.integer :${1:title}
${0}
snippet tcl
t.integer :lock_version, null: false, default: 0
${0}
snippet tcr
t.references :${1:taggable}, polymorphic: { default: '${2:Photo}' }
${0}
snippet tcs
t.string :${1:title}
${0}
snippet tct
t.text :${1:title}
${0}
snippet tcti
t.time :${1:title}
${0}
snippet tcts
t.timestamp :${1:title}
${0}
snippet tctss
t.timestamps
${0}
##########################
# Rspec snippets #
##########################
#ShouldaMatchers#ActionController
snippet isfp
it { should filter_param :${0:key} }
snippet isrt
it { should redirect_to ${0:url} }
snippet isrtp
it { should render_template ${0} }
snippet isrwl
it { should render_with_layout ${0} }
snippet isrf
it { should rescue_from ${0:exception} }
snippet isrw
it { should respond_with ${0:status} }
snippet isr
it { should route(:${1:method}, '${0:path}') }
snippet isss
it { should set_session :${0:key} }
snippet issf
it { should set_the_flash('${0}') }
#ShouldaMatchers#ActiveModel
snippet isama
it { should allow_mass_assignment_of :${0} }
snippet isav
it { should allow_value(${1}).for :${0} }
snippet isee
it { should ensure_exclusion_of :${0} }
snippet isei
it { should ensure_inclusion_of :${0} }
snippet isel
it { should ensure_length_of :${0} }
snippet isva
it { should validate_acceptance_of :${0} }
snippet isvc
it { should validate_confirmation_of :${0} }
snippet isvn
it { should validate_numericality_of :${0} }
snippet isvp
it { should validate_presence_of :${0} }
snippet isvu
it { should validate_uniqueness_of :${0} }
#ShouldaMatchers#ActiveRecord
snippet isana
it { should accept_nested_attributes_for :${0} }
snippet isbt
it { should belong_to :${0} }
snippet isbtcc
it { should belong_to(:${1}).counter_cache ${0:true} }
snippet ishbtm
it { should have_and_belong_to_many :${0} }
snippet isbv
it { should be_valid }
snippet ishc
it { should have_db_column :${0} }
snippet ishi
it { should have_db_index :${0} }
snippet ishm
it { should have_many :${0} }
snippet ishmt
it { should have_many(:${1}).through :${0} }
snippet isho
it { should have_one :${0} }
snippet ishro
it { should have_readonly_attribute :${0} }
snippet iss
it { should serialize :${0} }
snippet isres
it { should respond_to :${0} }
snippet isresw
it { should respond_to(:${1}).with(${0}).arguments }
snippet super_call
${1:super_class}.instance_method(:${0:method}).bind(self).call

View File

@ -0,0 +1,125 @@
#################
# Rust Snippets #
#################
# Functions
snippet fn
fn ${1:function_name}(${2}) {
${0}
}
snippet fn-
fn ${1:function_name}(${2}) -> ${3} {
${0}
}
snippet test
#[test]
fn ${1:test_function_name}() {
${0}
}
snippet new
pub fn new(${2}) -> ${1:Name} {
${0}return $1 { ${3} };
}
snippet main
pub fn main() {
${0}
}
snippet let
let ${1:name}${3} = ${2};
snippet pln
println!("${1}");
snippet pln,
println!("${1}", ${2});
snippet ec
extern crate ${1:sync};
snippet ecl
#![feature(phase)]
#[phase(plugin, link)] extern crate log;
snippet mod
mod ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
} /* $1 */
snippet crate
// 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}"]
snippet allow
#[allow(${1:unused_variable})]
snippet feat
#![feature(${1:macro_rules})]
# Common types
snippet opt
Option<${1:int}>
snippet res
Result<${1:~str}, ${2:()}>
snippet if
if ${1:/* condition */} {
${0}
}
snippet mat
match ${1} {
${2} => ${3},
}
snippet while
while ${1:condition} {
${0}
}
snippet for
for ${1:i} in ${2:range(0u, 10)} {
${0}
}
snippet spawn
spawn(proc() {
${0}
});
snippet chan
let (${1:tx}, ${2:rx}): (Sender<${3:int}>, Receiver<${4:int}>) = channel();
snippet duplex
let (${1:from_child}, ${2:to_child}) = sync::duplex();
# TODO commenting
snippet todo
// [TODO]: ${1:Description}
# Struct
snippet st
struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
}
impl $1 {
pub fn new(${2}) -> $1 {
${4}return $1 {
${5}
};
}
}
# Enum
snippet enum
enum ${1:enum_name} {
${0},
}
# Impl
snippet imp
impl ${1:Name} {
${0}
}
snippet drop
impl Drop for ${1:Name} {
fn drop(&mut self) {
${0}
}
}
# Traits
snippet trait
trait ${1:Name} {
${0}
}
# Statics
snippet ss
static ${1}: &'static str = "${0}";
snippet stat
static ${1}: ${2:uint} = ${0};

View File

@ -0,0 +1,36 @@
snippet +
(+ ${1}
${0})
snippet -
(- ${1}
${0})
snippet /
(/ ${1}
${0})
snippet *
(* ${1}
${0})
# Definition
snippet def
(define (${1:name})
(${0:definition}))
# Definition with lambda
snippet defl
(define ${1:name}
(lambda (x)(${0:definition})))
# Condition
snippet cond
(cond ((${1:predicate}) (${2:action}))
((${3:predicate}) (${0:action})))
# If statement
snippet if
(if (${1:predicate})
(${2:true-action})
(${0:false-action}))

View File

@ -0,0 +1,993 @@
snippet !
!important
snippet bdi:m+
-moz-border-image url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch}
snippet bdi:m
-moz-border-image ${0}
snippet bdrz:m
-moz-border-radius ${0}
snippet bxsh:m+
-moz-box-shadow ${1:0} ${2:0} ${3:0} ${0}
snippet bxsh:m
-moz-box-shadow ${0}
snippet bdi:w+
-webkit-border-image url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch}
snippet bdi:w
-webkit-border-image ${0}
snippet bdrz:w
-webkit-border-radius ${0}
snippet bxsh:w+
-webkit-box-shadow ${1:0} ${2:0} ${3:0} ${0}
snippet bxsh:w
-webkit-box-shadow ${0}
snippet @f
@font-face ${0}
snippet @i
@import '${0}'
snippet @r
@require '${0}'
snippet @m
@media ${1:screen}
snippet @msmw
@media screen and (min-width: ${0}px)
snippet @ext
@extend .${1}
${0}
snippet bg+
background ${1} url(${2}) ${3:0} ${4:0} ${0:no-repeat}
snippet bga
background-attachment ${0}
snippet bga:f
background-attachment fixed
snippet bga:s
background-attachment scroll
snippet bgbk
background-break ${0}
snippet bgbk:bb
background-break bounding-box
snippet bgbk:c
background-break continuous
snippet bgbk:eb
background-break each-box
snippet bgcp
background-clip ${0}
snippet bgcp:bb
background-clip border-box
snippet bgcp:cb
background-clip content-box
snippet bgcp:nc
background-clip no-clip
snippet bgcp:pb
background-clip padding-box
snippet bgc
background-color ${0}
snippet bgc:t
background-color transparent
snippet bgi
background-image url(${0})
snippet bgi:n
background-image none
snippet bgo
background-origin ${0}
snippet bgo:bb
background-origin border-box
snippet bgo:cb
background-origin content-box
snippet bgo:pb
background-origin padding-box
snippet bgpx
background-position-x ${0}
snippet bgpy
background-position-y ${0}
snippet bgp
background-position ${1:0} ${0:0}
snippet bgr
background-repeat ${0}
snippet bgr:n
background-repeat no-repeat
snippet bgr:x
background-repeat repeat-x
snippet bgr:y
background-repeat repeat-y
snippet bgr:r
background-repeat repeat
snippet bgz
background-size ${0}
snippet bgz:a
background-size auto
snippet bgz:ct
background-size contain
snippet bgz:cv
background-size cover
snippet bg
background ${0}
snippet bg:ie
filter progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${1}',sizingMethod='${0:crop}')
snippet bg:n
background none
snippet bd+
border ${1:1px} ${2:solid} ${0}
snippet bdb+
border-bottom ${1:1px} ${2:solid} ${0}
snippet bdbc
border-bottom-color ${0}
snippet bdbi
border-bottom-image url(${0})
snippet bdbi:n
border-bottom-image none
snippet bdbli
border-bottom-left-image url(${0})
snippet bdbli:c
border-bottom-left-image continue
snippet bdbli:n
border-bottom-left-image none
snippet bdblrz
border-bottom-left-radius ${0}
snippet bdbri
border-bottom-right-image url(${0})
snippet bdbri:c
border-bottom-right-image continue
snippet bdbri:n
border-bottom-right-image none
snippet bdbrrz
border-bottom-right-radius ${0}
snippet bdbs
border-bottom-style ${0}
snippet bdbs:n
border-bottom-style none
snippet bdbw
border-bottom-width ${0}
snippet bdb
border-bottom ${0}
snippet bdb:n
border-bottom none
snippet bdbk
border-break ${0}
snippet bdbk:c
border-break close
snippet bdcl
border-collapse ${0}
snippet bdcl:c
border-collapse collapse
snippet bdcl:s
border-collapse separate
snippet bdc
border-color ${0}
snippet bdci
border-corner-image url(${0})
snippet bdci:c
border-corner-image continue
snippet bdci:n
border-corner-image none
snippet bdf
border-fit ${0}
snippet bdf:c
border-fit clip
snippet bdf:of
border-fit overwrite
snippet bdf:ow
border-fit overwrite
snippet bdf:r
border-fit repeat
snippet bdf:sc
border-fit scale
snippet bdf:sp
border-fit space
snippet bdf:st
border-fit stretch
snippet bdi
border-image url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch}
snippet bdi:n
border-image none
snippet bdl+
border-left ${1:1px} ${2:solid} ${0}
snippet bdlc
border-left-color ${0}
snippet bdli
border-left-image url(${0})
snippet bdli:n
border-left-image none
snippet bdls
border-left-style ${0}
snippet bdls:n
border-left-style none
snippet bdlw
border-left-width ${0}
snippet bdl
border-left ${0}
snippet bdl:n
border-left none
snippet bdlt
border-length ${0}
snippet bdlt:a
border-length auto
snippet bdrz
border-radius ${0}
snippet bdr+
border-right ${1:1px} ${2:solid} ${0}
snippet bdrc
border-right-color ${0}
snippet bdri
border-right-image url(${0})
snippet bdri:n
border-right-image none
snippet bdrs
border-right-style ${0}
snippet bdrs:n
border-right-style none
snippet bdrw
border-right-width ${0}
snippet bdr
border-right ${0}
snippet bdr:n
border-right none
snippet bdsp
border-spacing ${0}
snippet bds
border-style ${0}
snippet bds:ds
border-style dashed
snippet bds:dtds
border-style dot-dash
snippet bds:dtdtds
border-style dot-dot-dash
snippet bds:dt
border-style dotted
snippet bds:db
border-style double
snippet bds:g
border-style groove
snippet bds:h
border-style hidden
snippet bds:i
border-style inset
snippet bds:n
border-style none
snippet bds:o
border-style outset
snippet bds:r
border-style ridge
snippet bds:s
border-style solid
snippet bds:w
border-style wave
snippet bdt+
border-top ${1:1px} ${2:solid} ${0}
snippet bdtc
border-top-color ${0}
snippet bdti
border-top-image url(${0})
snippet bdti:n
border-top-image none
snippet bdtli
border-top-left-image url(${0})
snippet bdtli:c
border-corner-image continue
snippet bdtli:n
border-corner-image none
snippet bdtlrz
border-top-left-radius ${0}
snippet bdtri
border-top-right-image url(${0})
snippet bdtri:c
border-top-right-image continue
snippet bdtri:n
border-top-right-image none
snippet bdtrrz
border-top-right-radius ${0}
snippet bdts
border-top-style ${0}
snippet bdts:n
border-top-style none
snippet bdtw
border-top-width ${0}
snippet bdt
border-top ${0}
snippet bdt:n
border-top none
snippet bdw
border-width ${0}
snippet bd
border ${0}
snippet bd:n
border none
snippet b
bottom ${0}
snippet b:a
bottom auto
snippet bxsh+
box-shadow ${1:0} ${2:0} ${3:0} ${0}
snippet bxsh
box-shadow ${0}
snippet bxsh:n
box-shadow none
snippet bxz
box-sizing ${0}
snippet bxz:bb
box-sizing border-box
snippet bxz:cb
box-sizing content-box
snippet cps
caption-side ${0}
snippet cps:b
caption-side bottom
snippet cps:t
caption-side top
snippet cl
clear ${0}
snippet cl:b
clear both
snippet cl:l
clear left
snippet cl:n
clear none
snippet cl:r
clear right
snippet cp
clip ${0}
snippet cp:a
clip auto
snippet cp:r
clip rect(${1:0} ${2:0} ${3:0} ${0:0})
snippet c
color ${0}
snippet ct
content ${0}
snippet ct:a
content attr(${0})
snippet ct:cq
content close-quote
snippet ct:c
content counter(${0})
snippet ct:cs
content counters(${0})
snippet ct:ncq
content no-close-quote
snippet ct:noq
content no-open-quote
snippet ct:n
content normal
snippet ct:oq
content open-quote
snippet coi
counter-increment ${0}
snippet cor
counter-reset ${0}
snippet cur
cursor ${0}
snippet cur:a
cursor auto
snippet cur:c
cursor crosshair
snippet cur:d
cursor default
snippet cur:ha
cursor hand
snippet cur:he
cursor help
snippet cur:m
cursor move
snippet cur:p
cursor pointer
snippet cur:t
cursor text
snippet d
display ${0}
snippet d:mib
display -moz-inline-box
snippet d:mis
display -moz-inline-stack
snippet d:b
display block
snippet d:cp
display compact
snippet d:ib
display inline-block
snippet d:itb
display inline-table
snippet d:i
display inline
snippet d:li
display list-item
snippet d:n
display none
snippet d:ri
display run-in
snippet d:tbcp
display table-caption
snippet d:tbc
display table-cell
snippet d:tbclg
display table-column-group
snippet d:tbcl
display table-column
snippet d:tbfg
display table-footer-group
snippet d:tbhg
display table-header-group
snippet d:tbrg
display table-row-group
snippet d:tbr
display table-row
snippet d:tb
display table
snippet ec
empty-cells ${0}
snippet ec:h
empty-cells hide
snippet ec:s
empty-cells show
snippet exp
expression()
snippet fl
float ${0}
snippet fl:l
float left
snippet fl:n
float none
snippet fl:r
float right
snippet f+
font ${1:1em} ${2:Arial},${0:sans-serif}
snippet fef
font-effect ${0}
snippet fef:eb
font-effect emboss
snippet fef:eg
font-effect engrave
snippet fef:n
font-effect none
snippet fef:o
font-effect outline
snippet femp
font-emphasize-position ${0}
snippet femp:a
font-emphasize-position after
snippet femp:b
font-emphasize-position before
snippet fems
font-emphasize-style ${0}
snippet fems:ac
font-emphasize-style accent
snippet fems:c
font-emphasize-style circle
snippet fems:ds
font-emphasize-style disc
snippet fems:dt
font-emphasize-style dot
snippet fems:n
font-emphasize-style none
snippet fem
font-emphasize ${0}
snippet ff
font-family ${0}
snippet ff:c
font-family ${0:'Monotype Corsiva','Comic Sans MS'},cursive
snippet ff:f
font-family ${0:Capitals,Impact},fantasy
snippet ff:m
font-family ${0:Monaco,'Courier New'},monospace
snippet ff:ss
font-family ${0:Helvetica,Arial},sans-serif
snippet ff:s
font-family ${0:Georgia,'Times New Roman'},serif
snippet fza
font-size-adjust ${0}
snippet fza:n
font-size-adjust none
snippet fz
font-size ${0}
snippet fsm
font-smooth ${0}
snippet fsm:aw
font-smooth always
snippet fsm:a
font-smooth auto
snippet fsm:n
font-smooth never
snippet fst
font-stretch ${0}
snippet fst:c
font-stretch condensed
snippet fst:e
font-stretch expanded
snippet fst:ec
font-stretch extra-condensed
snippet fst:ee
font-stretch extra-expanded
snippet fst:n
font-stretch normal
snippet fst:sc
font-stretch semi-condensed
snippet fst:se
font-stretch semi-expanded
snippet fst:uc
font-stretch ultra-condensed
snippet fst:ue
font-stretch ultra-expanded
snippet fs
font-style ${0}
snippet fs:i
font-style italic
snippet fs:n
font-style normal
snippet fs:o
font-style oblique
snippet fv
font-variant ${0}
snippet fv:n
font-variant normal
snippet fv:sc
font-variant small-caps
snippet fw
font-weight ${0}
snippet fw:b
font-weight bold
snippet fw:br
font-weight bolder
snippet fw:lr
font-weight lighter
snippet fw:n
font-weight normal
snippet f
font ${0}
snippet h
height ${0}
snippet h:a
height auto
snippet l
left ${0}
snippet l:a
left auto
snippet lts
letter-spacing ${0}
snippet lh
line-height ${0}
snippet lisi
list-style-image url(${0})
snippet lisi:n
list-style-image none
snippet lisp
list-style-position ${0}
snippet lisp:i
list-style-position inside
snippet lisp:o
list-style-position outside
snippet list
list-style-type ${0}
snippet list:c
list-style-type circle
snippet list:dclz
list-style-type decimal-leading-zero
snippet list:dc
list-style-type decimal
snippet list:d
list-style-type disc
snippet list:lr
list-style-type lower-roman
snippet list:n
list-style-type none
snippet list:s
list-style-type square
snippet list:ur
list-style-type upper-roman
snippet lis
list-style ${0}
snippet lis:n
list-style none
snippet mb
margin-bottom ${0}
snippet mb:a
margin-bottom auto
snippet ml
margin-left ${0}
snippet ml:a
margin-left auto
snippet mr
margin-right ${0}
snippet mr:a
margin-right auto
snippet mt
margin-top ${0}
snippet mt:a
margin-top auto
snippet m
margin ${0}
snippet m:4
margin ${1:0} ${2:0} ${3:0} ${0:0}
snippet m:3
margin ${1:0} ${2:0} ${0:0}
snippet m:2
margin ${1:0} ${0:0}
snippet m:0
margin 0
snippet m:a
margin auto
snippet mah
max-height ${0}
snippet mah:n
max-height none
snippet maw
max-width ${0}
snippet maw:n
max-width none
snippet mih
min-height ${0}
snippet miw
min-width ${0}
snippet op
opacity ${0}
snippet op:ie
filter progid:DXImageTransform.Microsoft.Alpha(Opacity=${0:100})
snippet op:ms
-ms-filter 'progid:DXImageTransform.Microsoft.Alpha(Opacity=${0:100})'
snippet orp
orphans ${0}
snippet o+
outline ${1:1px} ${2:solid} ${0}
snippet oc
outline-color ${0}
snippet oc:i
outline-color invert
snippet oo
outline-offset ${0}
snippet os
outline-style ${0}
snippet ow
outline-width ${0}
snippet o
outline ${0}
snippet o:n
outline none
snippet ovs
overflow-style ${0}
snippet ovs:a
overflow-style auto
snippet ovs:mq
overflow-style marquee
snippet ovs:mv
overflow-style move
snippet ovs:p
overflow-style panner
snippet ovs:s
overflow-style scrollbar
snippet ovx
overflow-x ${0}
snippet ovx:a
overflow-x auto
snippet ovx:h
overflow-x hidden
snippet ovx:s
overflow-x scroll
snippet ovx:v
overflow-x visible
snippet ovy
overflow-y ${0}
snippet ovy:a
overflow-y auto
snippet ovy:h
overflow-y hidden
snippet ovy:s
overflow-y scroll
snippet ovy:v
overflow-y visible
snippet ov
overflow ${0}
snippet ov:a
overflow auto
snippet ov:h
overflow hidden
snippet ov:s
overflow scroll
snippet ov:v
overflow visible
snippet pb
padding-bottom ${0}
snippet pl
padding-left ${0}
snippet pr
padding-right ${0}
snippet pt
padding-top ${0}
snippet p
padding ${0}
snippet p:4
padding ${1:0} ${2:0} ${3:0} ${0:0}
snippet p:3
padding ${1:0} ${2:0} ${0:0}
snippet p:2
padding ${1:0} ${0:0}
snippet p:0
padding 0
snippet pgba
page-break-after ${0}
snippet pgba:aw
page-break-after always
snippet pgba:a
page-break-after auto
snippet pgba:l
page-break-after left
snippet pgba:r
page-break-after right
snippet pgbb
page-break-before ${0}
snippet pgbb:aw
page-break-before always
snippet pgbb:a
page-break-before auto
snippet pgbb:l
page-break-before left
snippet pgbb:r
page-break-before right
snippet pgbi
page-break-inside ${0}
snippet pgbi:a
page-break-inside auto
snippet pgbi:av
page-break-inside avoid
snippet pos
position ${0}
snippet pos:a
position absolute
snippet pos:f
position fixed
snippet pos:r
position relative
snippet pos:s
position static
snippet q
quotes ${0}
snippet q:en
quotes '\201C' '\201D' '\2018' '\2019'
snippet q:n
quotes none
snippet q:ru
quotes '\00AB' '\00BB' '\201E' '\201C'
snippet rz
resize ${0}
snippet rz:b
resize both
snippet rz:h
resize horizontal
snippet rz:n
resize none
snippet rz:v
resize vertical
snippet r
right ${0}
snippet r:a
right auto
snippet tbl
table-layout ${0}
snippet tbl:a
table-layout auto
snippet tbl:f
table-layout fixed
snippet tal
text-align-last ${0}
snippet tal:a
text-align-last auto
snippet tal:c
text-align-last center
snippet tal:l
text-align-last left
snippet tal:r
text-align-last right
snippet ta
text-align ${0}
snippet ta:c
text-align center
snippet ta:l
text-align left
snippet ta:r
text-align right
snippet td
text-decoration ${0}
snippet td:l
text-decoration line-through
snippet td:n
text-decoration none
snippet td:o
text-decoration overline
snippet td:u
text-decoration underline
snippet te
text-emphasis ${0}
snippet te:ac
text-emphasis accent
snippet te:a
text-emphasis after
snippet te:b
text-emphasis before
snippet te:c
text-emphasis circle
snippet te:ds
text-emphasis disc
snippet te:dt
text-emphasis dot
snippet te:n
text-emphasis none
snippet th
text-height ${0}
snippet th:a
text-height auto
snippet th:f
text-height font-size
snippet th:m
text-height max-size
snippet th:t
text-height text-size
snippet ti
text-indent ${0}
snippet ti:-
text-indent -9999px
snippet tj
text-justify ${0}
snippet tj:a
text-justify auto
snippet tj:d
text-justify distribute
snippet tj:ic
text-justify inter-cluster
snippet tj:ii
text-justify inter-ideograph
snippet tj:iw
text-justify inter-word
snippet tj:k
text-justify kashida
snippet tj:t
text-justify tibetan
snippet to+
text-outline ${1:0} ${2:0} ${0}
snippet to
text-outline ${0}
snippet to:n
text-outline none
snippet tr
text-replace ${0}
snippet tr:n
text-replace none
snippet tsh+
text-shadow ${1:0} ${2:0} ${3:0} ${0}
snippet tsh
text-shadow ${0}
snippet tsh:n
text-shadow none
snippet tt
text-transform ${0}
snippet tt:c
text-transform capitalize
snippet tt:l
text-transform lowercase
snippet tt:n
text-transform none
snippet tt:u
text-transform uppercase
snippet tw
text-wrap ${0}
snippet tw:no
text-wrap none
snippet tw:n
text-wrap normal
snippet tw:s
text-wrap suppress
snippet tw:u
text-wrap unrestricted
snippet t
top ${0}
snippet t:a
top auto
snippet va
vertical-align ${0}
snippet va:bl
vertical-align baseline
snippet va:b
vertical-align bottom
snippet va:m
vertical-align middle
snippet va:sub
vertical-align sub
snippet va:sup
vertical-align super
snippet va:tb
vertical-align text-bottom
snippet va:tt
vertical-align text-top
snippet va:t
vertical-align top
snippet v
visibility ${0}
snippet v:c
visibility collapse
snippet v:h
visibility hidden
snippet v:v
visibility visible
snippet whsc
white-space-collapse ${0}
snippet whsc:ba
white-space-collapse break-all
snippet whsc:bs
white-space-collapse break-strict
snippet whsc:k
white-space-collapse keep-all
snippet whsc:l
white-space-collapse loose
snippet whsc:n
white-space-collapse normal
snippet whs
white-space ${0}
snippet whs:n
white-space normal
snippet whs:nw
white-space nowrap
snippet whs:pl
white-space pre-line
snippet whs:pw
white-space pre-wrap
snippet whs:p
white-space pre
snippet wid
widows ${0}
snippet w
width ${0}
snippet w:a
width auto
snippet wob
word-break ${0}
snippet wob:ba
word-break break-all
snippet wob:bs
word-break break-strict
snippet wob:k
word-break keep-all
snippet wob:l
word-break loose
snippet wob:n
word-break normal
snippet wos
word-spacing ${0}
snippet wow
word-wrap ${0}
snippet wow:no
word-wrap none
snippet wow:n
word-wrap normal
snippet wow:s
word-wrap suppress
snippet wow:u
word-wrap unrestricted
snippet z
z-index ${0}
snippet z:a
z-index auto
snippet zoo
zoom 1
snippet :h
:hover
snippet :fc
:first-child
snippet :lc
:last-child
snippet :nc
:nth-child(${0})
snippet :nlc
:nth-last-child(${0})
snippet :oc
:only-child
snippet :a
:after
snippet :b
:before
snippet ::a
::after
snippet ::b
::before
snippet if
if ${0}
snippet mix
${1}(${0})
snippet for
for ${1:i} in ${0}
snippet keyf
@keyframes ${0}