Brings current UltiSnips snippets into the repository.

This commit is contained in:
Holger Rapp 2014-02-26 09:31:33 +01:00 committed by Marc Weber
parent 3f7061a0ce
commit 59dcc2b72d
56 changed files with 2355 additions and 1034 deletions

View File

@ -1,4 +1,5 @@
This directory contains the main scripts that come bundled with UltiSnips. This directory contains the snippets for UltiSnips.
https://github.com/sirver/ultisnips
Standing On The Shoulders of Giants Standing On The Shoulders of Giants
=================================== ===================================
@ -10,12 +11,7 @@ two projects:
TextMate: http://svn.textmate.org/trunk/Bundles/ TextMate: http://svn.textmate.org/trunk/Bundles/
SnipMate: http://code.google.com/p/snipmate/ SnipMate: http://code.google.com/p/snipmate/
All snippets from those sources were copied and cleaned up, so that they are UltiSnips has seen contributions by many individuals. Those contributions have
- not using shell script, only python (so they are cross platform compatible) been merged into this collection seamlessly and without further comments.
- not using any feature that UltiSnips doesn't offer
UltiSnips has seen contributions by various individuals. Those contributions
have been merged into this collection seamlessly and without further comments.
-- vim:ft=rst:nospell: -- vim:ft=rst:nospell:

View File

@ -1,6 +1,8 @@
# This file contains snippets that are always defined. I personally # This file contains snippets that are always defined. I personally
# have snippets for signatures and often needed texts # have snippets for signatures and often needed texts
priority -50
############## ##############
# NICE BOXES # # NICE BOXES #
############## ##############
@ -19,11 +21,10 @@ def _parse_comments(s):
try: try:
while True: while True:
# get the flags and text of a comment part # get the flags and text of a comment part
flags,text = i.next().split(':', 1) flags, text = next(i).split(':', 1)
if len(flags) == 0: if len(flags) == 0:
if len(text) == 1: rv.append((text, text, text, ""))
rv.append((text,text,text, ""))
# parse 3-part comment, but ignore those with O flag # parse 3-part comment, but ignore those with O flag
elif flags[0] == 's' and 'O' not in flags: elif flags[0] == 's' and 'O' not in flags:
ctriple = [] ctriple = []
@ -33,50 +34,42 @@ def _parse_comments(s):
indent = " " * int(flags[-1]) indent = " " * int(flags[-1])
ctriple.append(text) ctriple.append(text)
flags,text = i.next().split(':', 1) flags,text = next(i).split(':', 1)
assert(flags[0] == 'm') assert(flags[0] == 'm')
ctriple.append(text) ctriple.append(text)
flags,text = i.next().split(':', 1) flags,text = next(i).split(':', 1)
assert(flags[0] == 'e') assert(flags[0] == 'e')
ctriple.append(text) ctriple.append(text)
ctriple.append(indent) ctriple.append(indent)
rv.append(ctriple) rv.append(ctriple)
elif flags[0] == 'b': elif flags[0] == 'b':
if len(text) == 1: if len(text) == 1:
rv.insert(0, (text,text,text, "")) rv.insert(0, (text,text,text, ""))
except StopIteration: except StopIteration:
return rv return rv
def _get_comment_format(): def _get_comment_format():
""" Returns a 4-element tuple representing the comment format for """ Returns a 4-element tuple representing the comment format for
the current file. """ the current file. """
return _parse_comments(vim.eval("&comments"))[0]
ft = vim.eval("&filetype")
# check if the comment dict has the format for the current file
if _commentDict.has_key(ft):
return _commentDict[ft]
# otherwise parse vim's comments and add it for later use
commentformat = _parse_comments(vim.eval("&comments"))[0]
_commentDict[ft] = commentformat
return commentformat
def make_box(twidth, bwidth = None): def make_box(twidth, bwidth=None):
if bwidth is None: b, m, e, i = _get_comment_format()
bwidth = twidth + 2 bwidth_inner = bwidth - 3 - max(len(b), len(i + e)) if bwidth else twidth + 2
b,m,e,i = _get_comment_format() sline = b + m + bwidth_inner * m[0] + 2 * m[0]
sline = b + m + bwidth*m + 2*m nspaces = (bwidth_inner - twidth) // 2
nspaces = (bwidth - twidth)//2 mlines = i + m + " " + " " * nspaces
mlines = i + m + " " + " "*nspaces mlinee = " " + " "*(bwidth_inner - twidth - nspaces) + m
mlinee = " " + " "*(bwidth-twidth-nspaces) + m eline = i + m + bwidth_inner * m[0] + 2 * m[0] + e
eline = i + 2*m + bwidth*m + m + e
return sline, mlines, mlinee, eline return sline, mlines, mlinee, eline
def foldmarker():
"Return a tuple of (open fold marker, close fold marker)"
return vim.eval("&foldmarker").split(",")
endglobal endglobal
snippet box "A nice box with the current comment symbol" b snippet box "A nice box with the current comment symbol" b
@ -91,14 +84,29 @@ endsnippet
snippet bbox "A nice box over the full width" b snippet bbox "A nice box over the full width" b
`!p `!p
box = make_box(len(t[1]), 71) width = int(vim.eval("&textwidth")) or 71
box = make_box(len(t[1]), width)
snip.rv = box[0] + '\n' + box[1] snip.rv = box[0] + '\n' + box[1]
`${1:content}`!p `${1:content}`!p
box = make_box(len(t[1]), 71) box = make_box(len(t[1]), width)
snip.rv = box[2] + '\n' + box[3]` snip.rv = box[2] + '\n' + box[3]`
$0 $0
endsnippet endsnippet
snippet fold "Insert a vim fold marker" b
`!p snip.rv = _get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]`${2:1} `!p snip.rv = _get_comment_format()[2]`
endsnippet
snippet foldc "Insert a vim fold close marker" b
`!p snip.rv = _get_comment_format()[0]` ${2:1}`!p snip.rv = foldmarker()[1]` `!p snip.rv = _get_comment_format()[2]`
endsnippet
snippet foldp "Insert a vim fold marker pair" b
`!p snip.rv = _get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]` `!p snip.rv = _get_comment_format()[2]`
${2:${VISUAL:Content}}
`!p snip.rv = _get_comment_format()[0]` `!p snip.rv = foldmarker()[1]` $1 `!p snip.rv = _get_comment_format()[2]`
endsnippet
########################## ##########################
# LOREM IPSUM GENERATORS # # LOREM IPSUM GENERATORS #
########################## ##########################

52
UltiSnips/bib.snippets Normal file
View File

@ -0,0 +1,52 @@
priority -50
snippet online "Online resource" b
@online{${1:name},
author={${2:author}},
title={${3:title}},
date={${4:date}},
url={${5:url}}
}
$0
endsnippet
snippet article "Article reference" b
@article{${1:name},
author={${2:author}},
title={${3:title}},
journaltitle={${4:journal}},
volume={${5:NN}},
number={${6:NN}},
year={${7:YYYY}},
pages={${8:NN}--${9:NN}}
}
$0
endsnippet
snippet book "Book reference" b
@book{${1:name},
author={${2:author}},
title={${3:title}},
subtitle={${4:subtitle}},
year={${5:YYYY}},
location={${6:somewhere}},
publisher={${7:publisher}},
pages={${8:NN}--${9:NN}}
}
$0
endsnippet
snippet inb "In Book reference" b
@inbook{${1:name},
author={${2:author}},
title={${3:title}},
subtitle={${4:subtitle}},
booktitle={${5:book}},
editor={${6:editor}},
year={${7:YYYY}},
location={${8:somewhere}},
publisher={${9:publisher}},
pages={${10:NN}--${11:NN}}
}
$0
endsnippet

View File

@ -1,3 +1,5 @@
priority -50
global !p global !p
def newsoa(): def newsoa():
import datetime import datetime

View File

@ -2,6 +2,8 @@
# TextMate Snippets # # TextMate Snippets #
########################################################################### ###########################################################################
priority -50
snippet def "#define ..." snippet def "#define ..."
#define ${1} #define ${1}
endsnippet endsnippet
@ -12,9 +14,9 @@ snippet ifndef "#ifndef ... #define ... #endif"
#endif #endif
endsnippet endsnippet
snippet #if "#if #endif" !b snippet #if "#if #endif" b
#if ${1:0} #if ${1:0}
${VISUAL:code}$0 ${VISUAL}${0:${VISUAL/(.*)/(?1::code)/}}
#endif #endif
endsnippet endsnippet
@ -36,17 +38,24 @@ $0
endsnippet endsnippet
snippet main "main() (main)" snippet main "main() (main)"
int main(int argc, char const *argv[]) int main(int argc, char *argv[])
{ {
${0:/* code */} ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
return 0; return 0;
} }
endsnippet endsnippet
snippet for "for int loop (fori)" snippet for "for loop (for)"
for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) for (${2:i} = 0; $2 < ${1:count}; ${3:++$2})
{ {
${0:/* code */} ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
}
endsnippet
snippet fori "for int loop (fori)"
for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2})
{
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
} }
endsnippet endsnippet
@ -75,9 +84,15 @@ snippet td "Typedef"
typedef ${1:int} ${2:MyCustomType}; typedef ${1:int} ${2:MyCustomType};
endsnippet endsnippet
snippet wh "while loop"
while(${1:/* condition */}) {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
}
endsnippet
snippet do "do...while loop (do)" snippet do "do...while loop (do)"
do { do {
${0:/* code */} ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
} while(${1:/* condition */}); } while(${1:/* condition */});
endsnippet endsnippet
@ -88,7 +103,19 @@ endsnippet
snippet if "if .. (if)" snippet if "if .. (if)"
if (${1:/* condition */}) if (${1:/* condition */})
{ {
${0:/* code */} ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
}
endsnippet
snippet el "else .. (else)"
else {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
}
endsnippet
snippet eli "else if .. (eli)"
else if (${1:/* condition */}) {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
} }
endsnippet endsnippet
@ -114,4 +141,15 @@ struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`}
}; };
endsnippet endsnippet
snippet fun "function" b
${1:void} ${2:function_name}(${3})
{
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
}
endsnippet
snippet fund "function declaration" b
${1:void} ${2:function_name}(${3});
endsnippet
# vim:ft=snippets: # vim:ft=snippets:

View File

@ -1,5 +1,4 @@
# From the TextMate bundle priority -50
# with some modification
snippet fun "Function" b snippet fun "Function" b
${1:name} = `!p snip.rv = "(" if t[2] else ""`${2:args}`!p snip.rv = ") " if t[2] else ""`-> ${1:name} = `!p snip.rv = "(" if t[2] else ""`${2:args}`!p snip.rv = ") " if t[2] else ""`->
@ -10,52 +9,52 @@ snippet bfun "Function (bound)" i
`!p snip.rv = "(" if t[1] else ""`${1:args}`!p snip.rv = ") " if t[1] else ""`=>`!p snip.rv = " " if t[2] and not t[2].startswith("\n") else ""`${2:expr} `!p snip.rv = "(" if t[1] else ""`${1:args}`!p snip.rv = ") " if t[1] else ""`=>`!p snip.rv = " " if t[2] and not t[2].startswith("\n") else ""`${2:expr}
endsnippet endsnippet
snippet if "If" snippet if "If" b
if ${1:condition} if ${1:condition}
${0:# body...} ${0:# body...}
endsnippet endsnippet
snippet ife "If .. Else" snippet ife "If .. Else" b
if ${1:condition} if ${1:condition}
${2:# body...} ${2:# body...}
else else
${3:# body...} ${3:# body...}
endsnippet endsnippet
snippet eif "Else if" b snippet elif "Else if" b
else if ${1:condition} else if ${1:condition}
${0:# body...} ${0:# body...}
endsnippet endsnippet
snippet ifte "Ternary if" snippet ifte "Ternary if" b
if ${1:condition} then ${2:value} else ${3:other} if ${1:condition} then ${2:value} else ${3:other}
endsnippet endsnippet
snippet unl "Unless" snippet unl "Unless" b
${1:action} unless ${2:condition} ${1:action} unless ${2:condition}
endsnippet endsnippet
snippet fora "Array Comprehension" snippet fora "Array Comprehension" b
for ${1:name} in ${2:array} for ${1:name} in ${2:array}
${0:# body...} ${0:# body...}
endsnippet endsnippet
snippet foro "Object Comprehension" snippet foro "Object Comprehension" b
for ${1:key}, ${2:value} of ${3:Object} for ${1:key}, ${2:value} of ${3:Object}
${0:# body...} ${0:# body...}
endsnippet endsnippet
snippet forr "Range Comprehension (inclusive)" snippet forr "Range Comprehension (inclusive)" b
for ${1:name} in [${2:start}..${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step} for ${1:name} in [${2:start}..${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step}
${0:# body...} ${0:# body...}
endsnippet endsnippet
snippet forrex "Range Comprehension (exclusive)" snippet forrex "Range Comprehension (exclusive)" b
for ${1:name} in [${2:start}...${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step} for ${1:name} in [${2:start}...${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step}
${0:# body...} ${0:# body...}
endsnippet endsnippet
snippet swi "Switch" snippet swi "Switch" b
switch ${1:object} switch ${1:object}
when ${2:value} when ${2:value}
${3:# body...} ${3:# body...}
@ -63,7 +62,7 @@ switch ${1:object}
$0 $0
endsnippet endsnippet
snippet swit "Switch when .. then" snippet swit "Switch when .. then" b
switch ${1:object} switch ${1:object}
when ${2:condition}`!p snip.rv = " then " if t[3] else ""`${3:value} when ${2:condition}`!p snip.rv = " then " if t[3] else ""`${3:value}
else`!p snip.rv = " " if t[4] and not t[4].startswith("\n") else ""`${4:value} else`!p snip.rv = " " if t[4] and not t[4].startswith("\n") else ""`${4:value}
@ -77,7 +76,7 @@ class ${1:ClassName}`!p snip.rv = " extends " if t[2] else ""`${2:Ancestor}
$0 $0
endsnippet endsnippet
snippet try "Try .. Catch" snippet try "Try .. Catch" b
try try
$1 $1
catch ${2:error} catch ${2:error}
@ -95,4 +94,3 @@ endsnippet
snippet log "Log" b snippet log "Log" b
console.log ${1:"${2:msg}"} console.log ${1:"${2:msg}"}
endsnippet endsnippet

View File

@ -2,8 +2,12 @@
# CoffeeScript versions -- adapted from the JS TextMate bundle + additions # CoffeeScript versions -- adapted from the JS TextMate bundle + additions
# for some jasmine-jquery matchers # for some jasmine-jquery matchers
# #
priority -50
extends coffee extends coffee
priority -49
snippet des "Describe (coffee)" b snippet des "Describe (coffee)" b
describe '${1:description}', -> describe '${1:description}', ->
$0 $0
@ -160,4 +164,3 @@ endsnippet
snippet noscw "expect was not called with (coffee)" b snippet noscw "expect was not called with (coffee)" b
expect(${1:target}).wasNotCalledWith(${2:arguments}) expect(${1:target}).wasNotCalledWith(${2:arguments})
endsnippet endsnippet

View File

@ -1,3 +1,10 @@
priority -50
extends c
# We want to overwrite everything in parent ft.
priority -49
########################################################################### ###########################################################################
# TextMate Snippets # # TextMate Snippets #
########################################################################### ###########################################################################
@ -20,7 +27,7 @@ endsnippet
snippet ns "namespace .. (namespace)" snippet ns "namespace .. (namespace)"
namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`} namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`}
{ {
$0 ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
}${1/.+/ \/* /m}$1${1/.+/ *\/ /m} }${1/.+/ \/* /m}$1${1/.+/ *\/ /m}
endsnippet endsnippet

328
UltiSnips/cs.snippets Normal file
View File

@ -0,0 +1,328 @@
#######################################################################
# C# Snippets for UltiSnips #
#######################################################################
priority -50
#########################
# classes and structs #
#########################
snippet namespace "namespace" b
namespace ${1:MyNamespace}
{
${VISUAL}$0
}
endsnippet
snippet class "class" w
class ${1:MyClass}
{
$0
}
endsnippet
snippet struct "struct" w
struct ${1:MyStruct}
{
$0
}
endsnippet
snippet interface "interface" w
interface I${1:Interface}
{
$0
}
endsnippet
snippet enum "enumeration" b
enum ${1:MyEnum} { ${2:Item} };
endsnippet
############
# Main() #
############
snippet sim "static int main" b
static int Main(string[] args)
{
$0
}
endsnippet
snippet svm "static void main" b
static void Main(string[] args)
{
$0
}
endsnippet
################
# properties #
################
snippet prop "Simple property declaration" b
public ${1:int} ${2:MyProperty} { get; set; }
endsnippet
snippet propfull "Full property declaration" b
private ${1:int} ${2:_myProperty};
public $1 ${3:MyProperty}
{
get { return $2; }
set { $2 = value; }
}
endsnippet
snippet propg "Property with a private setter" b
public ${1:int} ${2:MyProperty} { get; private set; }
endsnippet
############
# blocks #
############
snippet #if "#if #endif" b
#if ${1:DEBUG}
${VISUAL}$0
#endif
endsnippet
snippet #region "#region #endregion" b
#region ${1:Region}
${VISUAL}$0
#endregion
endsnippet
###########
# loops #
###########
snippet for "for loop" b
for (int ${1:i} = 0; $1 < ${2:10}; $1++)
{
${VISUAL}$0
}
endsnippet
snippet forr "for loop (reverse)" b
for (int ${1:i} = ${2:10}; $1 >= 0; $1--)
{
${VISUAL}$0
}
endsnippet
snippet foreach "foreach loop" b
foreach (${3:var} ${2:item} in ${1:items})
{
${VISUAL}$0
}
endsnippet
snippet while "while loop" b
while (${1:true})
{
${VISUAL}$0
}
endsnippet
snippet do "do loop" b
do
{
${VISUAL}$0
} while (${1:true});
endsnippet
###############
# branching #
###############
snippet if "if statement" b
if ($1)
{
${VISUAL}$0
}
endsnippet
snippet ife "if else statement" b
if ($1)
{
${VISUAL}$0
}
else
{
}
endsnippet
snippet elif "else if" b
else if ($1)
{
$0
}
endsnippet
snippet elseif "else if" b
else if ($1)
{
$0
}
endsnippet
snippet ifnn "if not null" b
if ($1 != null)
{
${VISUAL}$0
}
endsnippet
snippet switch "switch statement" b
switch (${1:statement})
{
case ${2:value}:
break;
default:
$0break;
}
endsnippet
snippet case "case" b
case ${1:value}:
$2
break;
endsnippet
##############
# wrappers #
##############
snippet using "using statement" b
using (${1:resource})
{
${VISUAL}$0
}
endsnippet
snippet unchecked "unchecked block" b
unchecked
{
${VISUAL}$0
}
endsnippet
snippet checked "checked block" b
checked
{
${VISUAL}$0
}
endsnippet
snippet unsafe "unsafe" b
unsafe
{
${VISUAL}$0
}
endsnippet
########################
# exception handling #
########################
snippet try "try catch block" b
try
{
${VISUAL}$0
}
catch (${1:Exception} ${2:e})
{
throw;
}
endsnippet
snippet tryf "try finally block" b
try
{
${VISUAL}$0
}
finally
{
}
endsnippet
snippet throw "throw"
throw new ${1}Exception("${2}");
endsnippet
##########
# LINQ #
##########
snippet from "LINQ syntax" b
var ${1:seq} =
from ${2:item1} in ${3:items1}
join ${4:item2} in ${5:items2} on $2.${6:prop1} equals $4.${7:prop2}
select ${8:$2.prop3}
where ${9:clause}
endsnippet
############################
# feedback and debugging #
############################
snippet da "Debug.Assert" b
Debug.Assert(${1:true});
endsnippet
snippet cw "Console.WriteLine" b
Console.WriteLine("$1");
endsnippet
# as you first type comma-separated parameters on the right, {n} values appear in the format string
snippet cwp "Console.WriteLine with parameters" b
Console.WriteLine("${2:`!p
snip.rv = ' '.join(['{' + str(i) + '}' for i in range(t[1].count(','))])
`}"${1:, something});
endsnippet
snippet mbox "Message box" b
MessageBox.Show("${1:message}");
endsnippet
##################
# full methods #
##################
snippet equals "Equals method" b
public override bool Equals(object obj)
{
if (obj == null || GetType() != obj.GetType())
{
return false;
}
$0
return base.Equals(obj);
}
endsnippet
##############
# comments #
##############
snippet /// "XML comment" b
/// <summary>
/// $1
/// </summary>
endsnippet

View File

@ -2,6 +2,8 @@
# Most of these came from TextMate # # Most of these came from TextMate #
########################################################################### ###########################################################################
priority -50
snippet ! "!important CSS (!)" snippet ! "!important CSS (!)"
${1:!important} ${1:!important}
endsnippet endsnippet

View File

@ -1,5 +1,7 @@
# Simple shortcuts # Simple shortcuts
priority -50
snippet imp "import (imp)" b snippet imp "import (imp)" b
import ${1:std.stdio}; import ${1:std.stdio};
endsnippet endsnippet
@ -126,7 +128,7 @@ else
} }
endsnippet endsnippet
snippet eif "else if (elif)" b snippet elif "else if (elif)" b
else if(${1:/*condition*/}) else if(${1:/*condition*/})
{ {
${VISUAL}${0:/*code*/} ${VISUAL}${0:/*code*/}
@ -265,11 +267,11 @@ this(${1:/*args*/})
} }
endsnippet endsnippet
snippet get "getter property (get)" ! snippet get "getter property (get)"
@property ${1:/*type*/} ${2:/*member_name*/}() const pure nothrow {return ${3:$2_};} @property ${1:/*type*/} ${2:/*member_name*/}() const pure nothrow {return ${3:$2_};}
endsnippet endsnippet
snippet set "setter property (set)" ! snippet set "setter property (set)"
@property void ${1:/*member_name*/}(${2:/*type*/} rhs) pure nothrow {${3:$1_} = rhs;} @property void ${1:/*member_name*/}(${2:/*type*/} rhs) pure nothrow {${3:$1_} = rhs;}
endsnippet endsnippet
@ -490,12 +492,11 @@ endsnippet
# Comments # Comments
snippet todo "TODO (todo)" ! snippet todo "TODO (todo)"
// TODO: ${1} // TODO: ${1}
endsnippet endsnippet
# DDoc # DDoc
snippet doc "generic ddoc block (doc)" b snippet doc "generic ddoc block (doc)" b

View File

@ -1,3 +1,5 @@
priority -50
# Generic Tags # Generic Tags
snippet % snippet %
{% ${1} %}${2} {% ${1} %}${2}
@ -24,7 +26,7 @@ endsnippet
snippet block snippet block
{% block ${1} %} {% block ${1} %}
${2} ${2}
{% endblock %} {% endblock $1 %}
endsnippet endsnippet
snippet # snippet #
@ -76,7 +78,7 @@ snippet if
{% endif %} {% endif %}
endsnippet endsnippet
snippet el snippet else
{% else %} {% else %}
${1} ${1}
endsnippet endsnippet

View File

@ -1,5 +1,7 @@
# Credit: @iurifg # Credit: @iurifg
priority -50
snippet do snippet do
do do
${1} ${1}

View File

@ -2,6 +2,8 @@
# TEXTMATE SNIPPETS # # TEXTMATE SNIPPETS #
########################################################################### ###########################################################################
priority -50
snippet pat "Case:Receive:Try Clause" snippet pat "Case:Receive:Try Clause"
${1:pattern}${2: when ${3:guard}} ->; ${1:pattern}${2: when ${3:guard}} ->;
${4:body} ${4:body}

View File

@ -1,3 +1,5 @@
priority -50
# TextMate added these variables to cope with changes in ERB handling # TextMate added these variables to cope with changes in ERB handling
# in different versions of Rails -- for instance, Rails 3 automatically # in different versions of Rails -- for instance, Rails 3 automatically
# strips whitespace so that it's no longer necessary to use a form like # strips whitespace so that it's no longer necessary to use a form like
@ -18,7 +20,6 @@ def textmate_var(var, snip):
TM_RAILS_TEMPLATE_END_RUBY_INLINE = snip.opt('g:tm_rails_template_end_ruby_inline', ' %>'), TM_RAILS_TEMPLATE_END_RUBY_INLINE = snip.opt('g:tm_rails_template_end_ruby_inline', ' %>'),
TM_RAILS_TEMPLATE_END_RUBY_BLOCK = '<% end %>' TM_RAILS_TEMPLATE_END_RUBY_BLOCK = '<% end %>'
) )
snip.rv = lookup[var] snip.rv = lookup[var]
return return
endglobal endglobal
@ -74,7 +75,7 @@ snippet ffhf "form_for hidden_field 2"
endsnippet endsnippet
snippet ffl "form_for label 2" snippet ffl "form_for label 2"
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.label :${1:attribute', snip)`${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` `!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.label :${1:attribute}${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet endsnippet
snippet ffpf "form_for password_field 2" snippet ffpf "form_for password_field 2"
@ -122,7 +123,7 @@ snippet f. "f.hidden_field"
endsnippet endsnippet
snippet f. "f.label" snippet f. "f.label"
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.label :${1:attribute', snip)`${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` `!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.label :${1:attribute}${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet endsnippet
snippet f. "f.password_field" snippet f. "f.password_field"
@ -148,13 +149,13 @@ endsnippet
snippet ffe "form_for with errors" snippet ffe "form_for with errors"
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`error_messages_for :${1:model}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` `!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`error_messages_for :${1:model}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_for @${2:$1} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)` `!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`form_for @${2:$1} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
$0 $0
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)` `!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
endsnippet endsnippet
snippet ff "form_for" snippet ff "form_for"
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_for @${1:model} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)` `!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`form_for @${1:model} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
$0 $0
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)` `!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
endsnippet endsnippet
@ -271,9 +272,9 @@ snippet st "submit_tag"
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`submit_tag "${1:Save changes}"${2:, :id => "${3:submit}"}${4:, :name => "${5:$3}"}${6:, :class => "${7:form_$3}"}${8:, :disabled => ${9:false}}${10:, :disable_with => "${11:Please wait...}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` `!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`submit_tag "${1:Save changes}"${2:, :id => "${3:submit}"}${4:, :name => "${5:$3}"}${6:, :class => "${7:form_$3}"}${8:, :disabled => ${9:false}}${10:, :disable_with => "${11:Please wait...}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet endsnippet
snippet el "else (ERB)" snippet else "else (ERB)"
<% else %> <% else %>
$0
endsnippet endsnippet
snippet if "if (ERB)" snippet if "if (ERB)"

View File

@ -1,5 +1,7 @@
# Snippets for Go # Snippets for Go
priority -50
# when to abbriviate and when not? # when to abbriviate and when not?
# b doesn't work here, because it ignores whitespace # b doesn't work here, because it ignores whitespace
# optional local name? # optional local name?
@ -31,37 +33,55 @@ const (
) )
endsnippet endsnippet
snippet struct "Struct declaration" b
type ${1:Struct} struct {
${0:${VISUAL}}
}
endsnippet
snippet interface "Interface declaration" b
type ${1:Interface} interface {
${0:${VISUAL}}
}
endsnippet
# statements # statements
snippet for "For loop" !b snippet for "For loop" b
for ${1:condition}${1/(.+)/ /}{ for ${1:condition}${1/(.+)/ /}{
${0:${VISUAL}} ${0:${VISUAL}}
} }
endsnippet endsnippet
snippet forr "For range loop" !b snippet forr "For range loop" b
for ${2:name} := range ${1:collection} { for ${2:name} := range ${1:collection} {
${0:${VISUAL}} ${0:${VISUAL}}
} }
endsnippet endsnippet
snippet if "If statement" !b snippet if "If statement" b
if ${1:condition}${1/(.+)/ /}{ if ${1:condition}${1/(.+)/ /}{
${0:${VISUAL}} ${0:${VISUAL}}
} }
endsnippet endsnippet
snippet switch "Switch statement" !b snippet switch "Switch statement" b
switch ${1:expression}${1/(.+)/ /}{ switch ${1:expression}${1/(.+)/ /}{
case${0} case${0}
} }
endsnippet endsnippet
snippet case "Case clause" !b snippet select "Select statement" b
select {
case${0}
}
endsnippet
snippet case "Case clause" b
case ${1:condition}: case ${1:condition}:
${0:${VISUAL}} ${0:${VISUAL}}
endsnippet endsnippet
snippet default "Default clause" !b snippet default "Default clause" b
default: default:
${0:${VISUAL}} ${0:${VISUAL}}
endsnippet endsnippet
@ -86,22 +106,26 @@ func ${1:name}(${2:params})${3/(.+)/ /}${3:type} {
endsnippet endsnippet
# types and variables # types and variables
snippet map "Map type" !b snippet map "Map type" b
map[${1:keytype}]${2:valtype} map[${1:keytype}]${2:valtype}
endsnippet endsnippet
snippet : "Variable declaration :=" !b snippet : "Variable declaration :=" b
${1:name} := ${0:value} ${1:name} := ${0:value}
endsnippet endsnippet
snippet var "Variable declaration" !b snippet var "Variable declaration" b
var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}} var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}}
endsnippet endsnippet
snippet vars "Variables declaration" !b snippet vars "Variables declaration" b
var ( var (
${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} } ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} }
) )
endsnippet endsnippet
snippet json "JSON field"
\`json:"${1:displayName}"\`
endsnippet
# vim:ft=snippets: # vim:ft=snippets:

View File

@ -1,13 +1,15 @@
snippet ife "if ... then ... else ..." priority -50
snippet if "if ... then ... else ..."
if ${1:condition} if ${1:condition}
then ${2:expression} then ${2:expression}
else ${3:expression} else ${3:expression}
endsnippet endsnippet
snippet case "case ... of ..." snippet case "case ... of ..."
case ${1} of case ${1:expression} of
${2} -> ${3} ${2:pattern} -> ${3:expression}
${4} -> ${5} ${4:pattern} -> ${5:expression}
endsnippet endsnippet
snippet :: "Type signature" snippet :: "Type signature"

View File

@ -1,5 +1,7 @@
# Snippets for VIM Help Files # Snippets for VIM Help Files
priority -50
global !p global !p
def sec_title(snip, t): def sec_title(snip, t):
file_start = snip.fn.split('.')[0] file_start = snip.fn.split('.')[0]

View File

@ -1,3 +1,5 @@
priority -50
########################################################################### ###########################################################################
# TextMate Snippets # # TextMate Snippets #
########################################################################### ###########################################################################
@ -123,21 +125,21 @@ endsnippet
############# #############
# HTML TAGS # # HTML TAGS #
############# #############
snippet input "Input with Label" snippet input "Input with Label" w
<label for="${2:${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}}">$1</label><input type="${3:text/submit/hidden/button}" name="${4:$2}" value="$5"${6: id="${7:$2}"}`!p x(snip)`> <label for="${2:${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}}">$1</label><input type="${3:text/submit/hidden/button}" name="${4:$2}" value="$5"${6: id="${7:$2}"}`!p x(snip)`>
endsnippet endsnippet
snippet input "XHTML <input>" snippet input "XHTML <input>" w
<input type="${1:text/submit/hidden/button}" name="${2:some_name}" value="$3"${4: id="${5:$2}"}`!p x(snip)`> <input type="${1:text/submit/hidden/button}" name="${2:some_name}" value="$3"${4: id="${5:$2}"}`!p x(snip)`>
endsnippet endsnippet
snippet opt "Option" snippet opt "Option" w
<option${1: value="${2:option}"}>${3:$2}</option> <option${1: value="${2:option}"}>${3:$2}</option>
endsnippet endsnippet
snippet select "Select Box" snippet select "Select Box" w
<select name="${1:some_name}" id="${2:$1}"${3:${4: multiple}${5: onchange="${6:}"}${7: size="${8:1}"}}> <select name="${1:some_name}" id="${2:$1}"${3:${4: multiple}${5: onchange="${6:}"}${7: size="${8:1}"}}>
<option${9: value="${10:option1}"}>${11:$10}</option> <option${9: value="${10:option1}"}>${11:$10}</option>
<option${12: value="${13:option2}"}>${14:$13}</option>${15:} <option${12: value="${13:option2}"}>${14:$13}</option>${15:}
@ -146,18 +148,22 @@ snippet select "Select Box"
endsnippet endsnippet
snippet textarea "XHTML <textarea>" snippet textarea "XHTML <textarea>" w
<textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">$0</textarea> <textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">$0</textarea>
endsnippet endsnippet
snippet mailto "XHTML <a mailto: >" snippet mailto "XHTML <a mailto: >" w
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a> <a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>
endsnippet endsnippet
snippet base "XHTML <base>" snippet base "XHTML <base>" w
<base href="$1"${2: target="$3"}`!p x(snip)`> <base href="$1"${2: target="$3"}`!p x(snip)`>
endsnippet endsnippet
snippet img "XHTML <img>" w
<img src="${1:imgsrc}">
endsnippet
snippet body "XHTML <body>" snippet body "XHTML <body>"
<body id="${1:`!p <body id="${1:`!p
snip.rv = snip.fn and 'Hallo' or 'Nothin' snip.rv = snip.fn and 'Hallo' or 'Nothin'
@ -166,13 +172,13 @@ snip.rv = snip.fn and 'Hallo' or 'Nothin'
</body> </body>
endsnippet endsnippet
snippet div "XHTML <div>" snippet div "XHTML <div>" w
<div`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`> <div`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""``!p snip.rv=' class="' if t[2] else ""`${2:name}`!p snip.rv = '"' if t[2] else ""`>
$0 $0
</div> </div>
endsnippet endsnippet
snippet form "XHTML <form>" snippet form "XHTML <form>" w
<form action="${1:`!p <form action="${1:`!p
snip.rv = (snip.basename or 'unnamed') + '_submit' snip.rv = (snip.basename or 'unnamed') + '_submit'
`}" method="${2:get}" accept-charset="utf-8"> `}" method="${2:get}" accept-charset="utf-8">
@ -182,7 +188,7 @@ snip.rv = (snip.basename or 'unnamed') + '_submit'
</form> </form>
endsnippet endsnippet
snippet h1 "XHTML <h1>" snippet h1 "XHTML <h1>" w
<h1 id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}">${1}</h1> <h1 id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}">${1}</h1>
endsnippet endsnippet
@ -194,71 +200,70 @@ snippet head "XHTML <head>"
</head> </head>
endsnippet endsnippet
snippet link "XHTML <link>" snippet link "XHTML <link>" w
<link rel="${1:stylesheet}" href="${2:/css/master.css}" type="text/css" media="${3:screen}" title="${4:no title}" charset="${5:utf-8}"`!p x(snip)`> <link rel="${1:stylesheet}" href="${2:/css/master.css}" type="text/css" media="${3:screen}" title="${4:no title}" charset="${5:utf-8}"`!p x(snip)`>
endsnippet endsnippet
snippet meta "XHTML <meta>" snippet meta "XHTML <meta>" w
<meta name="${1:name}" content="${2:content}"`!p x(snip)`> <meta name="${1:name}" content="${2:content}"`!p x(snip)`>
endsnippet endsnippet
snippet scriptsrc "XHTML <script src...>" snippet scriptsrc "XHTML <script src...>" w
<script src="$1" type="text/javascript" charset="${3:utf-8}"></script> <script src="$1" type="text/javascript" charset="${3:utf-8}"></script>
endsnippet endsnippet
snippet script "XHTML <script>" snippet script "XHTML <script>" w
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
$0 $0
</script> </script>
endsnippet endsnippet
snippet style "XHTML <style>" snippet style "XHTML <style>" w
<style type="text/css" media="screen"> <style type="text/css" media="screen">
$0 $0
</style> </style>
endsnippet endsnippet
snippet table "XHTML <table>" snippet table "XHTML <table>" w
<table border="${1:0}"${2: cellspacing="${3:5}" cellpadding="${4:5}"}> <table border="${1:0}"${2: cellspacing="${3:5}" cellpadding="${4:5}"}>
<tr><th>${5:Header}</th></tr> <tr><th>${5:Header}</th></tr>
<tr><td>${0:Data}</td></tr> <tr><td>${0:Data}</td></tr>
</table> </table>
endsnippet endsnippet
snippet a "Link" snippet a "Link" w
<a href="${1:http://www.${2:url.com}}"${3: target="_blank"}>${4:Anchor Text}</a> <a href="${1:http://www.${2:url.com}}"${3: target="_blank"}>${4:Anchor Text}</a>
endsnippet endsnippet
snippet p "paragraph" snippet p "paragraph" w
<p>$0</p> <p>$0</p>
endsnippet endsnippet
snippet li "list item" snippet li "list item" w
<li></li> <li>$0</li>
endsnippet endsnippet
snippet ul "unordered list" snippet ul "unordered list" w
<ul> <ul>
$0 $0
</ul> </ul>
endsnippet endsnippet
snippet td "table cell" snippet td "table cell" w
<td>$0</td> <td>$0</td>
endsnippet endsnippet
snippet tr "table row" snippet tr "table row" w
<tr>$0</tr> <tr>$0</tr>
endsnippet endsnippet
snippet title "XHTML <title>" snippet title "XHTML <title>" w
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title> <title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
endsnippet endsnippet
snippet fieldset "Fieldset" snippet fieldset "Fieldset" w
<fieldset id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}" ${2:class="${3:}"}> <fieldset id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}" ${2:class="${3:}"}>
<legend>$1</legend> <legend>$1</legend>
$0 $0
</fieldset> </fieldset>
endsnippet endsnippet
@ -282,7 +287,7 @@ snippet html5 "HTML5 Template"
<html> <html>
<head> <head>
<title>${1}</title> <title>${1}</title>
<meta charset="utf-8"> <meta charset="utf-8" />
</head> </head>
<body> <body>
<header> <header>

View File

@ -1,6 +1,8 @@
# more can be found in snippets/html_minimal.snippets # more can be found in snippets/html_minimal.snippets
# these UltiSnips override snippets because nested placeholders are being used # these UltiSnips override snippets because nested placeholders are being used
priority -50
snippet id snippet id
id="${1}"${2} id="${1}"${2}
endsnippet endsnippet

View File

@ -1 +1,3 @@
priority -50
extends html, django extends html, django

View File

@ -0,0 +1,3 @@
priority -50
extends html, jinja2

View File

@ -1,27 +1,75 @@
########################################################################### priority -50
# TEXTMATE SNIPPETS #
###########################################################################
# Many of the snippets here use a global option called # Many of the snippets here use a global option called
# "g:ultisnips_java_brace_style" which, if set to "nl" will put a newline # "g:ultisnips_java_brace_style" which, if set to "nl" will put a newline
# before '{' braces. # before '{' braces.
# Setting "g:ultisnips_java_junit" will change how the test method snippet
# looks, it is defaulted to junit4, setting this option to 3 will remove the
# @Test annotation from the method
global !p global !p
def junit(snip):
if snip.opt("g:ultisnips_java_junit", "") == "3":
snip += ""
else:
snip.rv += "@Test\n\t"
def nl(snip): def nl(snip):
if snip.opt("g:ultisnips_java_brace_style", "") == "nl": if snip.opt("g:ultisnips_java_brace_style", "") == "nl":
snip += "" snip += ""
else: else:
snip.rv += " " snip.rv += " "
def getArgs(group):
import re
word = re.compile('[a-zA-Z><.]+ \w+')
return [i.split(" ") for i in word.findall(group) ]
def camel(word):
return word[0].upper() + word[1:]
endglobal endglobal
snippet sleep "try sleep catch" b
try {
Thread.sleep(${1:1000});
} catch (InterruptedException e){
e.printStackTrace();
}
endsnippet
snippet /i|n/ "new primitive or int" br
${1:int} ${2:i} = ${3:1};
$0
endsnippet
snippet /o|v/ "new Object or variable" br
${1:Object} ${2:var} = new $1(${3});
endsnippet
snippet f "field" b
${1:private} ${2:String} ${3:`!p snip.rv = t[2].lower()`};
endsnippet
snippet ab "abstract" b snippet ab "abstract" b
abstract abstract $0
endsnippet endsnippet
snippet as "assert" b snippet as "assert" b
assert ${1:test}${2/(.+)/(?1: \: ")/}${2:Failure message}${2/(.+)/(?1:")/};$0 assert ${1:test}${2/(.+)/(?1: \: ")/}${2:Failure message}${2/(.+)/(?1:")/};$0
endsnippet endsnippet
snippet at "assert true" b
assertTrue(${1:actual});
endsnippet
snippet af "assert false" b
assertFalse(${1:actual});$0
endsnippet
snippet ae "assert equals" b
assertEquals(${1:expected}, ${2:actual});
endsnippet
snippet br "break" snippet br "break"
break; break;
@ -39,19 +87,85 @@ catch (${1:Exception} ${2:e})`!p nl(snip)`{
} }
endsnippet endsnippet
snippet cl "class" b snippet cle "class extends" b
class ${1:`!p public class ${1:`!p
snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent} }${4:implements ${5:Interface} }{ snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent} }${4:implements ${5:Interface} }{
$0 $0
} }
endsnippet endsnippet
snippet clc "class with constructor, fields, setter and getters" b
public class `!p
snip.rv = snip.basename or "untitled"` {
`!p
args = getArgs(t[1])
if len(args) == 0: snip.rv = ""
for i in args:
snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";"
if len(args) > 0:
snip.rv += "\n"`
public `!p snip.rv = snip.basename or "unknown"`($1) { `!p
args = getArgs(t[1])
for i in args:
snip.rv += "\n\t\tthis." + i[1] + " = " + i[1] + ";"
if len(args) == 0:
snip.rv += "\n"`
}$0
`!p
args = getArgs(t[1])
if len(args) == 0: snip.rv = ""
for i in args:
snip.rv += "\n\tpublic void set" + camel(i[1]) + "(" + i[0] + " " + i[1] + ") {\n" + "\
\tthis." + i[1] + " = " + i[1] + ";\n\t}\n"
snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\
\n\t\treturn " + i[1] + ";\n\t}\n"
`
}
endsnippet
snippet clc "class with constructor, with field names" b
public class `!p
snip.rv = snip.basename or "untitled"` {
`!p
args = getArgs(t[1])
for i in args:
snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";"
if len(args) > 0:
snip.rv += "\n"`
public `!p snip.rv = snip.basename or "unknown"`($1) { `!p
args = getArgs(t[1])
for i in args:
snip.rv += "\n\t\tthis." + i[1] + " = " + i[1]
if len(args) == 0:
snip.rv += "\n"`
}
}
endsnippet
snippet clc "class and constructor" b
public class `!p
snip.rv = snip.basename or "untitled"` {
public `!p snip.rv = snip.basename or "untitled"`($2) {
$0
}
}
endsnippet
snippet cl "class" b
public class ${1:`!p
snip.rv = snip.basename or "untitled"`} {
$0
}
endsnippet
snippet cos "constant string" b snippet cos "constant string" b
static public final String ${1:var} = "$2";$0 public static final String ${1:var} = "$2";$0
endsnippet endsnippet
snippet co "constant" b snippet co "constant" b
static public final ${1:String} ${2:var} = $3;$0 public static final ${1:String} ${2:var} = $3;$0
endsnippet endsnippet
snippet de "default" b snippet de "default" b
@ -59,7 +173,7 @@ default:
$0 $0
endsnippet endsnippet
snippet eif "else if" b snippet elif "else if" b
else if ($1)`!p nl(snip)`{ else if ($1)`!p nl(snip)`{
$0 $0
} }
@ -72,7 +186,7 @@ else`!p nl(snip)`{
endsnippet endsnippet
snippet fi "final" b snippet fi "final" b
final final $0
endsnippet endsnippet
snippet fore "for (each)" b snippet fore "for (each)" b
@ -81,6 +195,12 @@ for ($1 : $2)`!p nl(snip)`{
} }
endsnippet endsnippet
snippet fori "for" b
for (int ${1:i} = 0; $1 < ${2:10}; $1++)`!p nl(snip)`{
$0
}
endsnippet
snippet for "for" b snippet for "for" b
for ($1; $2; $3)`!p nl(snip)`{ for ($1; $2; $3)`!p nl(snip)`{
$0 $0
@ -99,7 +219,7 @@ $0
endsnippet endsnippet
snippet im "import" b snippet im "import" b
import import ${1:java}.${2:util}.$0
endsnippet endsnippet
snippet in "interface" b snippet in "interface" b
@ -108,6 +228,48 @@ interface ${1:`!p snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent
} }
endsnippet endsnippet
snippet cc "constructor call or setter body"
this.${1:var} = $1;
endsnippet
snippet list "Collections List" b
List<${1:String}> ${2:list} = new ${3:Array}List<$1>();
endsnippet
snippet map "Collections Map" b
Map<${1:String}, ${2:String}> ${3:map} = new ${4:Hash}Map<$1, $2>();
endsnippet
snippet set "Collections Set" b
Set<${1:String}> ${2:set} = new ${3:Hash}Set<$1>();
endsnippet
snippet /Str?|str/ "String" br
String $0
endsnippet
snippet cn "Constructor" b
public `!p snip.rv = snip.basename or "untitled"`(${1:}) {
$0
}
endsnippet
snippet cn "constructor, \w fields + assigments" b
`!p
args = getArgs(t[1])
for i in args:
snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";"
if len(args) > 0:
snip.rv += "\n"`
public `!p snip.rv = snip.basename or "unknown"`($1) { `!p
args = getArgs(t[1])
for i in args:
snip.rv += "\n\t\tthis." + i[1] + " = " + i[1]
if len(args) == 0:
snip.rv += "\n"`
}
endsnippet
snippet j.b "java_beans_" i snippet j.b "java_beans_" i
java.beans. java.beans.
endsnippet endsnippet
@ -134,15 +296,70 @@ public static void main(String[] args)`!p nl(snip)`{
} }
endsnippet endsnippet
snippet m "method" b snippet try "try/catch" b
${1:void} ${2:method}($3) ${4:throws $5 }{ try {
$1
} catch(${2:Exception} ${3:e}){
${4:e.printStackTrace();}
}
endsnippet
snippet mt "method throws" b
${1:private} ${2:void} ${3:method}(${4}) ${5:throws $6 }{
$0 $0
} }
endsnippet
snippet m "method" b
${1:private} ${2:void} ${3:method}(${4}) {
$0
}
endsnippet
snippet md "Method With javadoc" b
/**
* ${7:Short Description}`!p
for i in getArgs(t[4]):
snip.rv += "\n\t * @param " + i[1] + " usage..."`
* `!p
if "throws" in t[5]:
snip.rv = "\n\t * @throws " + t[6]
else:
snip.rv = ""` `!p
if not "void" in t[2]:
snip.rv = "\n\t * @return object"
else:
snip.rv = ""`
**/
${1:public} ${2:void} ${3:method}($4) ${5:throws $6 }{
$0
}
endsnippet
snippet /get(ter)?/ "getter" br
public ${1:String} get${2:Name}() {
return `!p snip.rv = t[2].lower()`;
}
endsnippet
snippet /set(ter)?/ "setter" br
public void set${1:Name}(${2:String} $1) {
return this.`!p snip.rv = t[1].lower()` = `!p snip.rv = t[1].lower()`;
}
endsnippet
snippet /se?tge?t|ge?tse?t|gs/ "setter and getter" br
public void set${1:Name}(${2:String} `!p snip.rv = t[1].lower()`) {
this.`!p snip.rv = t[1].lower()` = `!p snip.rv = t[1].lower()`;
}
public $2 get$1() {
return `!p snip.rv = t[1].lower()`;
}
endsnippet endsnippet
snippet pa "package" b snippet pa "package" b
package package $0
endsnippet endsnippet
snippet p "print" b snippet p "print" b
@ -154,33 +371,33 @@ System.out.println($1);$0
endsnippet endsnippet
snippet pr "private" b snippet pr "private" b
private private $0
endsnippet endsnippet
snippet po "protected" b snippet po "protected" b
protected protected $0
endsnippet endsnippet
snippet pu "public" b snippet pu "public" b
public public $0
endsnippet endsnippet
snippet re "return" b snippet re "return" b
return return $0
endsnippet endsnippet
snippet st "static" snippet st "static"
static static $0
endsnippet endsnippet
snippet sw "switch" b snippet sw "switch" b
switch ($1)`!p nl(snip)`{ switch ($1)`!p nl(snip)`{
$0 case $2: $0
} }
endsnippet endsnippet
snippet sy "synchronized" snippet sy "synchronized"
synchronized synchronized $0
endsnippet endsnippet
snippet tc "test case" snippet tc "test case"
@ -190,17 +407,19 @@ public class ${1:`!p snip.rv = snip.basename or "untitled"`} extends ${2:TestCas
endsnippet endsnippet
snippet t "test" b snippet t "test" b
public void test${1:Name}() throws Exception`!p nl(snip)`{ `!p junit(snip)`public void test${1:Name}() {
$0
}
endsnippet
snippet tt "test throws" b
`!p junit(snip)`public void test${1:Name}() ${2:throws Exception }{
$0 $0
} }
endsnippet endsnippet
snippet th "throw" b snippet th "throw" b
throw $0 throw new $0
endsnippet
snippet v "variable" b
${1:String} ${2:var}${3: = ${0:null}};
endsnippet endsnippet
snippet wh "while" b snippet wh "while" b

View File

@ -1,3 +1,5 @@
priority -50
########################################################################### ###########################################################################
# TextMate Snippets # # TextMate Snippets #
########################################################################### ###########################################################################
@ -6,19 +8,19 @@ getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}('$2')
endsnippet endsnippet
snippet '':f "object method string" snippet '':f "object method string"
'${1:${2:#thing}:${3:click}}': function(element){ '${1:${2:#thing}:${3:click}}': function(element) {
$0 ${VISUAL}$0
}${10:,} }${10:,}
endsnippet endsnippet
snippet :f "Object Method" snippet :f "Object Method"
${1:method_name}: function(${3:attribute}){ ${1:method_name}: function(${3:attribute}) {
$0 ${VISUAL}$0
}${10:,} }${10:,}
endsnippet endsnippet
snippet :, "Object Value JS" snippet :, "Object Value JS"
${1:value_name}:${0:value}, ${1:value_name}: ${0:value},
endsnippet endsnippet
snippet : "Object key key: 'value'" snippet : "Object key key: 'value'"
@ -26,47 +28,135 @@ ${1:key}: ${2:"${3:value}"}${4:, }
endsnippet endsnippet
snippet proto "Prototype (proto)" snippet proto "Prototype (proto)"
${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) ,,{ ${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {
${0} ${VISUAL}$0
} };
endsnippet endsnippet
snippet for "for (...) {...} (faster)" snippet for "for (...) {...} (counting up)" b
for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2--){ for (var ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) {
${3:$1[$2]}$0 ${VISUAL}$0
} }
endsnippet endsnippet
snippet for "for (...) {...}" snippet ford "for (...) {...} (counting down, faster)" b
for (var ${2:i}=0; $2 < ${1:Things}.length; $2++) { for (var ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) {
${3:$1[$2]}$0 ${VISUAL}$0
} }
endsnippet endsnippet
snippet fun "function (fun)" snippet fun "function (fun)"
function ${1:function_name} (${2:argument}) { function ${1:function_name}(${2:argument}) {
${0} ${VISUAL}$0
} }
endsnippet endsnippet
# for one line if .. else you usually use a ? b : c snippet iife "Immediately-Invoked Function Expression (iife)"
(function (${1:argument}) {
${VISUAL}$0
}(${2:$1}));
endsnippet
snippet ife "if ___ else" snippet ife "if ___ else"
if (${1}) { if (${1:condition}) {
${2} ${2://code}
} else { }
${3} else {
${3://code}
} }
endsnippet endsnippet
snippet if "if" snippet if "if"
if (${1}) { if (${1:condition}) {
${2} ${VISUAL}$0
} }
endsnippet endsnippet
snippet timeout "setTimeout function" snippet timeout "setTimeout function"
setTimeout(function() {$0}${2:}, ${1:10}) setTimeout(function() {
${VISUAL}$0
}${2:.bind(${3:this})}, ${1:10});
endsnippet
# Snippets for Console Debug Output
snippet ca "console.assert" b
console.assert(${1:assertion}, ${2:"${3:message}"});
endsnippet
snippet cclear "console.clear" b
console.clear();
endsnippet
snippet cdir "console.dir" b
console.dir(${1:object});
endsnippet
snippet cdirx "console.dirxml" b
console.dirxml(${1:object});
endsnippet
snippet ce "console.error" b
console.error(${1:"${2:value}"});
endsnippet
snippet cgroup "console.group" b
console.group("${1:label}");
${VISUAL}$0
console.groupEnd();
endsnippet
snippet cgroupc "console.groupCollapsed" b
console.groupCollapsed("${1:label}");
${VISUAL}$0
console.groupEnd();
endsnippet
snippet ci "console.info" b
console.info(${1:"${2:value}"});
endsnippet
snippet cl "console.log" b
console.log(${1:"${2:value}"});
endsnippet
snippet cprof "console.profile" b
console.profile("${1:label}");
${VISUAL}$0
console.profileEnd();
endsnippet
snippet ctable "console.table" b
console.table(${1:"${2:value}"});
endsnippet
snippet ctime "console.time" b
console.time("${1:label}");
${VISUAL}$0
console.timeEnd("$1");
endsnippet
snippet ctimestamp "console.timeStamp" b
console.timeStamp("${1:label}");
endsnippet
snippet ctrace "console.trace" b
console.trace();
endsnippet
snippet cw "console.warn" b
console.warn(${1:"${2:value}"});
endsnippet
# AMD (Asynchronous Module Definition) snippets
snippet def "define an AMD module"
define(${1:optional_name, }[${2:'jquery'}], ${3:callback});
endsnippet
snippet req "require an AMD module"
require([${1:'dependencies'}], ${2:callback});
endsnippet endsnippet
# vim:ft=snippets: # vim:ft=snippets:

View File

@ -2,6 +2,8 @@
# Ember snippets # # Ember snippets #
################################################################### ###################################################################
priority -50
# Application # Application
snippet eapp "App.Name = Ember.Application.create({});" snippet eapp "App.Name = Ember.Application.create({});"
${1:App.Name} = Ember.Application.create({}); ${1:App.Name} = Ember.Application.create({});

View File

@ -1,8 +1,8 @@
# priority -50
# JavaScript versions -- from the TextMate bundle + some additions # JavaScript versions -- from the TextMate bundle + some additions
# for jasmine-jquery matchers # for jasmine-jquery matchers
# #
extends javascript
snippet des "Describe (js)" b snippet des "Describe (js)" b
describe('${1:description}', function() { describe('${1:description}', function() {
@ -165,4 +165,3 @@ endsnippet
snippet noscw "expect was not called with (js)" b snippet noscw "expect was not called with (js)" b
expect(${1:target}).wasNotCalledWith(${2:arguments}); expect(${1:target}).wasNotCalledWith(${2:arguments});
endsnippet endsnippet

View File

@ -0,0 +1,51 @@
priority -50
# JSDoc snippets
snippet /* "A JSDoc comment" b
/**
* ${1:${VISUAL}}$0
*/
endsnippet
snippet @au "@author email (First Last)"
@author ${1:`!v g:snips_author_email`} (${2:`!v g:snips_author`})
endsnippet
snippet @li "@license Description"
@license ${1:MIT}$0
endsnippet
snippet @ver "@version Semantic version"
@version ${1:0.1.0}$0
endsnippet
snippet @fileo "@fileoverview Description" b
/**
* @fileoverview ${1:${VISUAL:A description of the file}}$0
*/
endsnippet
snippet @constr "@constructor"
@constructor
endsnippet
snippet @p "@param {Type} varname Description"
@param {${1:Type}} ${2:varname} ${3:Description}
endsnippet
snippet @ret "@return {Type} Description"
@return {${1:Type}} ${2:Description}
endsnippet
snippet @pri "@private"
@private
endsnippet
snippet @over "@override"
@override
endsnippet
snippet @pro "@protected"
@protected
endsnippet

View File

@ -1,3 +1,4 @@
priority -50
# http://jinja.pocoo.org/ # http://jinja.pocoo.org/
@ -151,7 +152,6 @@ snippet with "with" b
{% endwith %} {% endwith %}
endsnippet endsnippet
snippet autoescape "autoescape" b snippet autoescape "autoescape" b
{% autoescape ${1:true} %} {% autoescape ${1:true} %}
$2 $2

View File

@ -1,3 +1,5 @@
priority -50
snippet s "String" b snippet s "String" b
"${1:key}": "${0:value}", "${1:key}": "${0:value}",
endsnippet endsnippet
@ -16,4 +18,3 @@ snippet o "Object" b
${VISUAL}$0 ${VISUAL}$0
}, },
endsnippet endsnippet

View File

@ -0,0 +1,8 @@
priority -50
snippet t "Transaction" b
${1:`!v strftime("%Y")`}-${2:`!v strftime("%m")`}-${3:`!v strftime("%d")`} ${4:*} ${5:Payee}
${6:Expenses} \$${7:0.00}
${8:Assets:Checking}
$0
endsnippet

View File

@ -0,0 +1,3 @@
priority -50
extends haskell

View File

@ -1,3 +1,5 @@
priority -50
################################# #################################
# Snippets for the Lua language # # Snippets for the Lua language #
################################# #################################

View File

@ -1,3 +1,5 @@
priority -50
################# #################
# From snipmate # # From snipmate #
################# #################

View File

@ -1,6 +1,4 @@
########################################################################### priority -50
# SNIPPETS for MARKDOWN #
###########################################################################
########################### ###########################
# Sections and Paragraphs # # Sections and Paragraphs #

View File

@ -1,3 +1,5 @@
priority -50
########################################################################### ###########################################################################
# TextMate Snippets # # TextMate Snippets #
########################################################################### ###########################################################################
@ -189,7 +191,7 @@ if(choice == NSAlertDefaultReturn) // "$3"
} }
else if(choice == NSAlertAlternateReturn) // "$4" else if(choice == NSAlertAlternateReturn) // "$4"
{ {
$0
} }
endsnippet endsnippet

View File

@ -1,20 +1,22 @@
priority -50
snippet rs "raise" b snippet rs "raise" b
raise (${1:Not_found}) raise (${1:Not_found})
endsnippet endsnippet
snippet open "open" snippet open "open"
let open ${1:module} in let open ${1:module} in
${2} ${2:e}
endsnippet endsnippet
snippet try "try" snippet try "try"
try ${1} try ${1:e}
with ${2:Not_found} -> ${3:()} with ${2:Not_found} -> ${3:()}
endsnippet endsnippet
snippet ref "ref" snippet ref "ref"
let ${1} = ref ${2} in let ${1:name} = ref ${2:val} in
${3} ${3:e}
endsnippet endsnippet
snippet matchl "pattern match on a list" snippet matchl "pattern match on a list"
@ -24,83 +26,88 @@ match ${1:list} with
endsnippet endsnippet
snippet matcho "pattern match on an option type" snippet matcho "pattern match on an option type"
match ${1} with match ${1:x} with
| Some(${2}) -> ${3:()} | Some(${2:y}) -> ${3:()}
| None -> ${4:()} | None -> ${4:()}
endsnippet endsnippet
snippet fun "anonymous function" snippet fun "anonymous function"
(fun ${1} -> ${2}) (fun ${1:x} -> ${2:x})
endsnippet endsnippet
snippet cc "commment" snippet cc "commment"
(* ${1} *) (* ${1:comment} *)
endsnippet endsnippet
snippet let "let .. in binding" snippet let "let .. in binding"
let ${1} = ${2} in let ${1:x} = ${2:v} in
${3} ${3:e}
endsnippet endsnippet
snippet lr "let rec" snippet lr "let rec"
let rec ${1} = let rec ${1:f} =
${2} ${2:expr}
endsnippet endsnippet
snippet ife "if" snippet if "if"
if ${1} then if ${1:(* condition *)} then
${2} ${2:(* A *)}
else else
${3} ${3:(* B *)}
endsnippet endsnippet
snippet if "If" snippet If "If"
if ${1} then if ${1:(* condition *)} then
${2} ${2:(* A *)}
endsnippet endsnippet
snippet wh "while" snippet while "while"
while ${1} do while ${1:(* condition *)} do
${2} ${2:(* A *)}
done done
endsnippet endsnippet
snippet for "for" snippet for "for"
for ${1:i} = ${2:1} to ${3:10} do for ${1:i} = ${2:1} to ${3:10} do
${4} ${4:(* BODY *)}
done done
endsnippet endsnippet
snippet match "match" snippet match "match"
match ${1} with match ${1:(* e1 *)} with
| ${2} -> ${3} | ${2:p} -> ${3:e2}
endsnippet
snippet Match "match"
match ${1:(* e1 *)} with
| ${2:p} -> ${3:e2}
endsnippet endsnippet
snippet class "class" snippet class "class"
class ${1:name} = object class ${1:name} = object
${2} ${2:methods}
end end
endsnippet endsnippet
snippet obj "obj" snippet obj "obj"
object object
${2} ${2:methods}
end end
endsnippet endsnippet
snippet Obj "object" snippet Obj "object"
object (self) object (self)
${2} ${2:methods}
end end
endsnippet endsnippet
snippet {{ "object functional update" snippet {{ "object functional update"
{< ${1} = ${2} >} {< ${1:x} = ${2:y} >}
endsnippet endsnippet
snippet beg "beg" snippet beg "beg"
begin begin
${1}${VISUAL} ${1:block}
end end
endsnippet endsnippet
@ -110,19 +117,19 @@ endsnippet
snippet mod "module - no signature" snippet mod "module - no signature"
module ${1:(* Name *)} = struct module ${1:(* Name *)} = struct
${2} ${2:(* BODY *)}
end end
endsnippet endsnippet
snippet Mod "module with signature" snippet Mod "module with signature"
module ${1:(* Name *)} : ${2:(* SIG *)} = struct module ${1:(* Name *)} : ${2:(* SIG *)} = struct
${3} ${3:(* BODY *)}
end end
endsnippet endsnippet
snippet sig "anonymous signature" snippet sig "anonymous signature"
sig sig
${2} ${2:(* BODY *)}
end end
endsnippet endsnippet
@ -132,32 +139,32 @@ endsnippet
snippet func "define functor - no signature" snippet func "define functor - no signature"
module ${1:M} (${2:Arg} : ${3:ARG}) = struct module ${1:M} (${2:Arg} : ${3:ARG}) = struct
${4} ${4:(* BODY *)}
end end
endsnippet endsnippet
snippet Func "define functor - with signature" snippet Func "define functor - with signature"
module ${1:M} (${2:Arg} : ${3:ARG}) : ${4:SIG} = struct module ${1:M} (${2:Arg} : ${3:ARG}) : ${4:SIG} = struct
${5} ${5:(* BODY *)}
end end
endsnippet endsnippet
snippet mot "Declare module signature" snippet mot "Declare module signature"
module type ${1:(* Name *)} = sig module type ${1:(* Name *)} = sig
${2} ${2:(* BODY *)}
end end
endsnippet endsnippet
snippet module "Module with anonymous signature" snippet module "Module with anonymous signature"
module ${1:(* Name *)} : sig module ${1:(* Name *)} : sig
${2} ${2:(* SIGNATURE *)}
end = struct end = struct
${3} ${3:(* BODY *)}
end end
endsnippet endsnippet
snippet oo "odoc" snippet oo "odoc"
(** ${1} *) (** ${1:odoc} *)
endsnippet endsnippet
snippet qt "inline qtest" snippet qt "inline qtest"

View File

@ -1,10 +1,13 @@
priority -50
########################################################################### ###########################################################################
# TextMate Snippets # # TextMate Snippets #
########################################################################### ###########################################################################
snippet ife "Conditional if..else (ife)" snippet ife "Conditional if..else (ife)"
if ($1) { if ($1) {
${2:# body...} ${2:# body...}
} else { }
else {
${3:# else...} ${3:# else...}
} }
@ -13,9 +16,11 @@ endsnippet
snippet ifee "Conditional if..elsif..else (ifee)" snippet ifee "Conditional if..elsif..else (ifee)"
if ($1) { if ($1) {
${2:# body...} ${2:# body...}
} elsif ($3) { }
elsif ($3) {
${4:# elsif...} ${4:# elsif...}
} else { }
else {
${5:# else...} ${5:# else...}
} }
@ -49,7 +54,7 @@ ${1:expression} while ${2:condition};
endsnippet endsnippet
snippet test "Test" snippet test "Test"
#!/usr/bin/perl -w #!/usr/bin/env perl -w
use strict; use strict;
use Test::More tests => ${1:1}; use Test::More tests => ${1:1};
@ -62,7 +67,7 @@ endsnippet
snippet class "class" snippet class "class"
package ${1:ClassName}; package ${1:ClassName};
${2:use base qw(${3:ParentClass});}${2/.+/\n\n/}sub new { ${2:use parent qw(${3:ParentClass});}${2/.+/\n\n/}sub new {
my $class = shift; my $class = shift;
$class = ref $class if ref $class; $class = ref $class if ref $class;
my $self = bless {}, $class; my $self = bless {}, $class;
@ -74,11 +79,12 @@ ${2:use base qw(${3:ParentClass});}${2/.+/\n\n/}sub new {
endsnippet endsnippet
snippet eval "eval" snippet eval "eval"
local $@;
eval { eval {
${1:# do something risky...} ${1:# do something risky...}
}; };
if ($@) { if (my $${2:exception} = $@) {
${2:# handle failure...} ${3:# handle failure...}
} }
endsnippet endsnippet
@ -105,8 +111,7 @@ if ($1) {
endsnippet endsnippet
snippet slurp "slurp" snippet slurp "slurp"
my $${1:var}; my $${1:var} = do { local $/ = undef; open my $fh, '<', ${2:$file}; <$fh> };
{ local $/ = undef; local *FILE; open FILE, "<${2:file}"; $$1 = <FILE>; close FILE }
endsnippet endsnippet
@ -117,7 +122,7 @@ unless ($1) {
endsnippet endsnippet
snippet wh "while" snippet while "while"
while ($1) { while ($1) {
${2:# body...} ${2:# body...}
} }

View File

@ -1,108 +1,264 @@
snippet <? "php open tag" b priority -50
<?php
## Snippets from SnipMate, taken from
## https://github.com/scrooloose/snipmate-snippets.git
snippet array "array"
$${1:arrayName} = array('${2}' => ${3});${4}
endsnippet endsnippet
snippet vdd "php var_dump and die" snippet def "def"
var_dump(${1}); die(); define('${1}'${2});${3}
endsnippet endsnippet
snippet ns "php namespace" b snippet do "do"
namespace ${1:`!p do {
abspath = os.path.abspath(path) ${2:// code... }
m = re.search(r'[A-Z].+(?=/)', abspath) } while (${1:/* condition */});"
if m:
snip.rv = m.group().replace('/', '\\')
`};
endsnippet endsnippet
snippet nc "php namespace and class or interface" b snippet doc_f "doc_f"
namespace ${1:`!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
if m:
snip.rv = m.group().replace('/', '\\')
`};
/** /**
* ${3:@author `whoami`}${4} * $2
*/ * @return ${4:void}
`!p * @author ${5:`!v g:snips_author`}
m = re.search(r'Abstract', path) **/
if m: ${1:public }function ${2:someFunc}(${3})
snip.rv = 'abstract ' {${6}
``!p
if re.search(r'Interface', path):
snip.rv = 'interface'
elif re.search(r'Trait', path):
snip.rv = 'trait'
else:
snip.rv = 'class'
` ${2:`!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
`}
{
} }
endsnippet endsnippet
snippet st "php static function" b snippet doc_i "doc_i"
${1:public} static function $2($3)
{
${4}
}
endsnippet
snippet __ "php constructor" b
${1:public} function __construct($2)
{
${3}
}
endsnippet
snippet sg "Setter and Getter" b
/** /**
* @var ${3:`!p snip.rv = t[2][0:1].upper() + t[2][1:]`} * $1
* * @package ${2:default}
* ${4} * @author ${3:`!v g:snips_author`}
**/
interface ${1:someClass}
{${4}
} // END interface $1"
endsnippet
snippet else "else"
else {
${1:// code...}
}
endsnippet
snippet for "for"
for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
${4:// code...}
}
endsnippet
snippet foreachk "foreachk"
foreach ($${1:variable} as $${2:key} => $${3:value}){
${4:// code...}
}
endsnippet
snippet get "get"
$_GET['${1}']${2}
endsnippet
snippet if "if"
if (${1:/* condition */}) {
${2:// code...}
}
endsnippet
snippet inc "inc"
include '${1:file}';${2}
endsnippet
snippet log "log"
error_log(var_export(${1}, true));${2}
endsnippet
snippet post "post"
$_POST['${1}']${2}
endsnippet
snippet req1 "req1"
require_once '${1:file}';${2}
endsnippet
snippet session "session"
$_SESSION['${1}']${2}
endsnippet
snippet t "t"
$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5}
endsnippet
snippet var "var"
var_export(${1});${2}
endsnippet
snippet getter "PHP Class Getter" b
/*
* Getter for $1
*/ */
${1:protected} $${2}; public function get${1/\w+\s*/\u$0/}()
public function set`!p snip.rv = t[2][0:1].upper() + t[2][1:]`(`!p
if re.match(r'^(\\|[A-Z]).*', t[3]):
snip.rv = t[3] + ' '
else:
snip.rv = ''
`$$2)
{ {
$this->$2 = $$2; return $this->$1;$2
return $this;
}
public function get`!p snip.rv = t[2][0:1].upper() + t[2][1:]`()
{
return $this->$2;
} }
$4
endsnippet endsnippet
snippet if "php if" !b snippet setter "PHP Class Setter" b
if (${1}) { /*
${2} * Setter for $1
*/
public function set${1/\w+\s*/\u$0/}($$1)
{
$this->$1 = $$1;$3
${4:return $this;}
} }
$0
endsnippet endsnippet
snippet ife "php ife" !b snippet gs "PHP Class Getter Setter" b
if (${1}) { /*
${2} * Getter for ${1/(\w+)\s*;/$1/}
*/
public function get${1/(\w+)\s*;/\u$1/}()
{
return $this->${1/(\w+)\s*;/$1/};$2
}
/*
* Setter for ${1/(\w+)\s*;/$1/}
*/
public function set${1/(\w+)\s*;/\u$1/}($${1/(\w+)\s*;/$1/})
{
$this->${1/(\w+)\s*;/$1/} = $${1/(\w+)\s*;/$1/};$3
${4:return $this;}
}
$0
endsnippet
snippet pub "Public function" b
public function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet pro "Protected function" b
protected function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet pri "Private function" b
private function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet pubs "Public static function" b
public static function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet pros "Protected static function" b
protected static function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet pris "Private static function" b
private static function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet fu "Function snip" b
function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet fore "Foreach loop"
foreach ($${1:variable} as $${3:value}){
${VISUAL}${4}
}
$0
endsnippet
snippet new "New class instance" b
$$1 = new $1($2);
$0
endsnippet
snippet ife "if else"
if (${1:/* condition */}) {
${2:// code...}
} else { } else {
${3:// code...}
}
$0
endsnippet
snippet class "Class declaration template" b
/**
* Class ${1:`!p snip.rv=snip.fn.split('.')[0]`}
* @author ${2:`!v g:snips_author`}
*/
class $1
{
public function ${3:__construct}(${4:$options})
{
${4:// code}
}
}
$0
endsnippet
snippet construct "__construct()" b
/**
* @param $2mixed ${1/, /\n * \@param mixed /g}
*/
public function __construct(${1:$dependencies})
{${1/\$(\w+)(, )*/\n $this->$1 = $$1;/g}
}
$0
endsnippet
snippet pr "Dumb debug helper in HTML"
echo '<pre>' . var_export($1, 1) . '</pre>';$0
endsnippet
snippet pc "Dumb debug helper in cli"
var_export($1);$0
endsnippet
# Symfony 2 based snippets
snippet sfa "Symfony 2 Controller action"
/**
* @Route("/${1:route_name}", name="$1")
* @Template()
*/
public function $1Action($2)
{
$3
return ${4:array();}$0
} }
endsnippet endsnippet
snippet /** "php comment block" b # :vim:ft=snippets:
/**
* @${1}
*/
endsnippet

View File

@ -1,5 +1,7 @@
# sugguestion? report bugs? # suggestion? report bugs?
# please go to https://github.com/chrisyue/vim-snippets/issues # please go to https://github.com/chrisyue/vim-snippets/issues
priority -50
snippet test "phpunit test class" b snippet test "phpunit test class" b
namespace `!p namespace `!p
abspath = os.path.abspath(path) abspath = os.path.abspath(path)

View File

@ -1,6 +1,8 @@
# sugguestion? report bugs? # sugguestion? report bugs?
# go to https://github.com/chrisyue/vim-snippets/issues # go to https://github.com/chrisyue/vim-snippets/issues
priority -50
snippet contr "Symfony2 controller" b snippet contr "Symfony2 controller" b
namespace `!p namespace `!p
abspath = os.path.abspath(path) abspath = os.path.abspath(path)

View File

@ -1,11 +1,82 @@
# Snippets for Puppet priority -50
snippet /^class/ "Class declaration" r #########################################################################
class ${1:name} { # Python helper code #
#########################################################################
global !p
import vim
import os.path
def get_module_namespace_and_basename():
"""This function will try to guess the current class or define name you are
trying to create. Note that for this to work you should be using the module
structure as per the style guide. Examples inputs and it's output
* /home/nikolavp/puppet/modules/collectd/manifests/init.pp -> collectd
* /home/nikolavp/puppet/modules/collectd/manfistes/mysql.pp -> collectd::mysql
"""
first_time = True
current_file_path_without_ext = vim.eval('expand("%:p:r")') or ""
if not current_file_path_without_ext:
return "name"
parts = os.path.split(current_file_path_without_ext)
namespace = ''
while parts[0] and parts[0] != '/':
if parts[1] == 'init' and first_time and not namespace:
first_time = False
parts = os.path.split(parts[0])
continue
if parts[1] == 'manifests':
return os.path.split(parts[0])[1] + ('::' + namespace).rstrip(':')
else:
namespace = parts[1] + '::' + namespace
parts = os.path.split(parts[0])
# couldn't guess the namespace. The user is editing a raw file in no module like the site.pp file
return "name"
endglobal
###############################################################################
# Puppet Language Constructs #
# See http://docs.puppetlabs.com/puppet/latest/reference/lang_summary.html #
###############################################################################
snippet class "Class declaration" b
class ${1:`!p snip.rv = get_module_namespace_and_basename()`} {
${0:# body} ${0:# body}
} }
endsnippet endsnippet
snippet define "Definition" b
define ${1:`!p snip.rv = get_module_namespace_and_basename()`} {
${0:# body}
}
endsnippet
#################################################################
# Puppet Types #
# See http://docs.puppetlabs.com/references/latest/type.html #
#################################################################
snippet cron "Cron resource type" b
cron { '${1:name}':
user => ${2:user},
command => '${3:command}',
minute => ${3:minute},
hour => ${4:hour},
}
endsnippet
snippet exec "Exec resource type" b
exec { '${1:command}':
refreshonly => true,
}
endsnippet
snippet file "File resource type" b
file { '${1:name}':
source => "puppet://${2:path}",
mode => ${3:mode},
endsnippet
snippet File "Defaults for file" b snippet File "Defaults for file" b
File { File {
owner => ${1:username}, owner => ${1:username},
@ -13,66 +84,149 @@ File {
} }
endsnippet endsnippet
# Resource types
snippet package "Package resource type" b
package { "${1:name}":
ensure => ${2:installed},
}
endsnippet
snippet file "File resource type" b
file { "${1:name}":
source => "puppet://${2:path}",
mode => ${3:mode},
endsnippet
snippet group "Group resource type" b snippet group "Group resource type" b
group { "${1:groupname}": group { '${1:groupname}':
ensure => ${3:present}, ensure => ${3:present},
gid => ${2:gid}, gid => ${2:gid},
endsnippet endsnippet
snippet mount "Mount resource type" b
mount { '${1:path}':
device => '${2:/dev}',
fstype => '${3:filesystem}',
ensure => mounted,
options => 'rw,errors=remount-ro',
}
endsnippet
snippet package "Package resource type" b
package { '${1:name}':
ensure => ${2:installed},
}
endsnippet
snippet user "user resource type" b snippet user "user resource type" b
group { "${1:username}": user { '${1:username}':
ensure => ${2:present}, ensure => ${2:present},
uid => ${3:uid}, uid => ${3:uid},
gid => ${4:gid}, gid => ${4:gid},
comment => ${5:gecos}, comment => ${5:gecos},
home => ${6:homedirectory}, home => ${6:homedirectory},
managehome => false, managehome => false,
require => Group["${7:group"], require => Group['${7:group'}],
endsnippet
snippet exec "Exec resource type" b
exec { "${1:command}":
refreshonly => true,
}
endsnippet
snippet cron "Cron resource type" b
cron { "${1:name}":
user => ${2:user},
command => "${3:command}",
minute => ${3:minute},
hour => ${4:hour},
}
endsnippet
snippet mount "Mount resource type" b
mount { "${1:path}":
device => "${2:/dev}",
fstype => "${3:filesystem}",
ensure => mounted,
options => "rw,errors=remount-ro",
}
endsnippet endsnippet
snippet service "Service resource type" b snippet service "Service resource type" b
service { "${1:name}": service { '${1:name}':
hasstatus => true, hasstatus => true,
enable => true, enable => true,
ensure => running, ensure => running,
} }
endsnippet endsnippet
########################################################################
# Puppet Functions #
# See http://docs.puppetlabs.com/references/latest/function.html #
########################################################################
snippet alert "Alert Function" b
alert("${1:message}")${0}
endsnippet
snippet crit "Crit Function" b
crit("${1:message}")${0}
endsnippet
snippet debug "Debug Function" b
debug("${1:message}")${0}
endsnippet
snippet defined "Defined Function" b
defined(${1:Resource}["${2:name}"])${0}
endsnippet
snippet emerg "Emerg Function" b
emerg("${1:message}")${0}
endsnippet
snippet extlookup "Simple Extlookup" b
$${1:Variable} = extlookup("${2:Lookup}")${0}
endsnippet
snippet extlookup "Extlookup with defaults" b
$${1:Variable} = extlookup("${2:Lookup}", ${3:Default})${0}
endsnippet
snippet extlookup "Extlookup with defaults and custom data file" b
$${1:Variable} = extlookup("${2:Lookup}", ${3:Default}, ${4:Data Source})${0}
endsnippet
snippet fail "Fail Function" b
fail("${1:message}")${0}
endsnippet
snippet hiera "Hiera Function" b
$${1:Variable} = hiera("${2:Lookup}")${0}
endsnippet
snippet hiera "Hiera with defaults" b
$${1:Variable} = hiera("${2:Lookup}", ${3:Default})${0}
endsnippet
snippet hiera "Hiera with defaults and override" b
$${1:Variable} = hiera("${2:Lookup}", ${3:Default}, ${4:Override})${0}
endsnippet
snippet hiera_hash "Hiera Hash Function" b
$${1:Variable} = hiera_hash("${2:Lookup}")${0}
endsnippet
snippet hiera_hash "Hiera Hash with defaults" b
$${1:Variable} = hiera_hash("${2:Lookup}", ${3:Default})${0}
endsnippet
snippet hiera_hash "Hiera Hash with defaults and override" b
$${1:Variable} = hiera_hash("${2:Lookup}", ${3:Default}, ${4:Override})${0}
endsnippet
snippet hiera_include "Hiera Include Function" b
hiera_include("${1:Lookup}")${0}
endsnippet
snippet include "Include Function" b
include ${1:classname}${0}
endsnippet
snippet info "Info Function" b
info("${1:message}")${0}
endsnippet
snippet inline_template "Inline Template Function" b
inline_template("<%= ${1:template} %>")${0}
endsnippet
snippet notice "Notice Function" b
notice("${1:message}")${0}
endsnippet
snippet realize "Realize Function" b
realize(${1:Resource}["${2:name}"])${0}
endsnippet
snippet regsubst "Regsubst Function" b
regsubst($${1:Target}, '${2:regexp}', '${3:replacement}')${0}
endsnippet
snippet split "Split Function" b
$${1:Variable} = split($${1:Target}, '${2:regexp}')${0}
endsnippet
snippet versioncmp "Version Compare Function" b
$${1:Variable} = versioncmp('${1:version}', '${2:version}')${0}
endsnippet
snippet warning "Warning Function" b
warning("${1:message}")${0}
endsnippet
# vim:ft=snippets: # vim:ft=snippets:

View File

@ -1,3 +1,5 @@
priority -50
########################################################################### ###########################################################################
# TEXTMATE SNIPPETS # # TEXTMATE SNIPPETS #
########################################################################### ###########################################################################
@ -14,6 +16,10 @@ if __name__ == '__main__':
${1:main()}$0 ${1:main()}$0
endsnippet endsnippet
snippet for "for loop" b
for ${1:item} in ${2:iterable}:
${3:pass}
endsnippet
########## ##########
# COMMON # # COMMON #
@ -29,6 +35,9 @@ NORMAL = 0x1
DOXYGEN = 0x2 DOXYGEN = 0x2
SPHINX = 0x3 SPHINX = 0x3
SINGLE_QUOTES = 0x1
DOUBLE_QUOTES = 0x2
def get_args(arglist): def get_args(arglist):
args = [arg.split('=')[0].strip() for arg in arglist.split(',') if arg] args = [arg.split('=')[0].strip() for arg in arglist.split(',') if arg]
args = [arg for arg in args if arg and arg != "self"] args = [arg for arg in args if arg and arg != "self"]
@ -36,6 +45,17 @@ def get_args(arglist):
return args return args
def get_quoting_style(snip):
style = snip.opt("g:ultisnips_python_quoting_style", "double")
if style == 'single':
return SINGLE_QUOTES
return DOUBLE_QUOTES
def tripple_quotes(snip):
if get_quoting_style(snip) == SINGLE_QUOTES:
return "'''"
return '"""'
def get_style(snip): def get_style(snip):
style = snip.opt("g:ultisnips_python_style", "normal") style = snip.opt("g:ultisnips_python_style", "normal")
@ -62,7 +82,7 @@ def format_return(style):
def write_docstring_args(args, snip): def write_docstring_args(args, snip):
if not args: if not args:
snip.rv += ' """' snip.rv += ' {0}'.format(tripple_quotes(snip))
return return
snip.rv += '\n' + snip.mkline('', indent='') snip.rv += '\n' + snip.mkline('', indent='')
@ -88,7 +108,7 @@ def write_init_body(args, parents, snip):
def write_slots_args(args, snip): def write_slots_args(args, snip):
args = ['"%s"' % arg for arg in args] args = ['"_%s"' % arg for arg in args]
snip += '__slots__ = (%s,)' % ', '.join(args) snip += '__slots__ = (%s,)' % ', '.join(args)
endglobal endglobal
@ -99,10 +119,11 @@ endglobal
snippet class "class with docstrings" b snippet class "class with docstrings" b
class ${1:MyClass}(${2:object}): class ${1:MyClass}(${2:object}):
"""${3:Docstring for $1 }"""
`!p snip.rv = tripple_quotes(snip)`${3:Docstring for $1. }`!p snip.rv = tripple_quotes(snip)`
def __init__(self$4): def __init__(self$4):
"""${5:@todo: to be defined}`!p `!p snip.rv = tripple_quotes(snip)`${5:@todo: to be defined1.}`!p
snip.rv = "" snip.rv = ""
snip >> 2 snip >> 2
@ -111,7 +132,7 @@ args = get_args(t[4])
write_docstring_args(args, snip) write_docstring_args(args, snip)
if args: if args:
snip.rv += '\n' + snip.mkline('', indent='') snip.rv += '\n' + snip.mkline('', indent='')
snip += '"""' snip += '{0}'.format(tripple_quotes(snip))
write_init_body(args, t[2], snip) write_init_body(args, t[2], snip)
` `
@ -121,7 +142,8 @@ endsnippet
snippet slotclass "class with slots and docstrings" b snippet slotclass "class with slots and docstrings" b
class ${1:MyClass}(${2:object}): class ${1:MyClass}(${2:object}):
"""${3:Docstring for $1 }"""
`!p snip.rv = tripple_quotes(snip)`${3:Docstring for $1. }`!p snip.rv = tripple_quotes(snip)`
`!p `!p
snip >> 1 snip >> 1
args = get_args(t[4]) args = get_args(t[4])
@ -129,7 +151,7 @@ write_slots_args(args, snip)
` `
def __init__(self$4): def __init__(self$4):
"""${5:@todo: to be defined}`!p `!p snip.rv = tripple_quotes(snip)`${5:@todo: to be defined.}`!p
snip.rv = "" snip.rv = ""
snip >> 2 snip >> 2
@ -138,7 +160,7 @@ args = get_args(t[4])
write_docstring_args(args, snip) write_docstring_args(args, snip)
if args: if args:
snip.rv += '\n' + snip.mkline('', indent='') snip.rv += '\n' + snip.mkline('', indent='')
snip += '"""' snip += tripple_quotes(snip)
write_init_body(args, t[2], snip) write_init_body(args, t[2], snip)
` `
@ -331,7 +353,7 @@ snippet def "function with docstrings" b
def ${1:function}(`!p def ${1:function}(`!p
if snip.indent: if snip.indent:
snip.rv = 'self' + (", " if len(t[2]) else "")`${2:arg1}): snip.rv = 'self' + (", " if len(t[2]) else "")`${2:arg1}):
"""${4:@todo: Docstring for $1}`!p `!p snip.rv = tripple_quotes(snip)`${4:@todo: Docstring for $1.}`!p
snip.rv = "" snip.rv = ""
snip >> 1 snip >> 1
@ -342,7 +364,7 @@ if args:
style = get_style(snip) style = get_style(snip)
snip += format_return(style) snip += format_return(style)
snip.rv += '\n' + snip.mkline('', indent='') snip.rv += '\n' + snip.mkline('', indent='')
snip += '"""' ` snip += tripple_quotes(snip) `
${0:pass} ${0:pass}
endsnippet endsnippet
@ -362,23 +384,57 @@ endsnippet
############## ##############
snippet roprop "Read Only Property" b snippet roprop "Read Only Property" b
@property @property
def ${1:property}(self): def ${1:name}(self):
${2:return self._$1}$0 ${2:return self._$1}$0
endsnippet endsnippet
snippet rwprop "Read write property" b snippet rwprop "Read write property" b
def ${1:property}(): def ${1:name}():
${2/.+/(?0:""")/}${2:The RW property $1}`!p if t[2]: `!p snip.rv = tripple_quotes(snip) if t[2] else ''
snip.rv += '"""' `${2:@todo: Docstring for $1.}`!p
if t[2]:
snip >> 1 snip >> 1
snip += ""
style = get_style(snip)
snip.rv += '\n' + snip.mkline('', indent='')
snip += format_return(style)
snip.rv += '\n' + snip.mkline('', indent='')
snip += tripple_quotes(snip)
else: else:
snip.rv = ""`def fget(self): snip.rv = ""`
def fget(self):
return self._$1$0 return self._$1$0
def fset(self, value): def fset(self, value):
self._$1 = value self._$1 = value
return locals() return locals()
$1 = property(**$1())
$1 = property(**$1(), doc=$1.__doc__)
endsnippet
####################
# If / Else / Elif #
####################
snippet if "If" b
if ${1:condition}:
${2:pass}
endsnippet
snippet ife "If / Else" b
if ${1:condition}:
${2:pass}
else:
${3:pass}
endsnippet
snippet ifee "If / Elif / Else" b
if ${1:condition}:
${2:pass}
elif ${3:condition}:
${4:pass}
else:
${5:pass}
endsnippet endsnippet
@ -430,6 +486,14 @@ snippet pdb "Set PDB breakpoint" b
import pdb; pdb.set_trace() import pdb; pdb.set_trace()
endsnippet endsnippet
snippet ipdb "Set IPDB breakpoint" b
import ipdb; ipdb.set_trace()
endsnippet
snippet pudb "Set PUDB breakpoint" b
import pudb; pudb.set_trace()
endsnippet
snippet ae "Assert equal" b snippet ae "Assert equal" b
self.assertEqual(${1:first},${2:second}) self.assertEqual(${1:first},${2:second})
endsnippet endsnippet
@ -453,7 +517,8 @@ endsnippet
snippet testcase "pyunit testcase" b snippet testcase "pyunit testcase" b
class Test${1:Class}(${2:unittest.TestCase}): class Test${1:Class}(${2:unittest.TestCase}):
"""${3:Test case docstring}"""
`!p snip.rv = tripple_quotes(snip)`${3:Test case docstring.}`!p snip.rv = tripple_quotes(snip)`
def setUp(self): def setUp(self):
${4:pass} ${4:pass}

View File

@ -1,6 +1,4 @@
########################################################################### priority -50
# GENERATED FROM get_tm_snippets.py #
###########################################################################
snippet anaf "accepts_nested_attributes_for" snippet anaf "accepts_nested_attributes_for"
accepts_nested_attributes_for :${1:association_name}${2:${3:, :allow_destroy => true}${4:, :reject_if => proc \{ |obj| ${5:obj.blank?} \}}} accepts_nested_attributes_for :${1:association_name}${2:${3:, :allow_destroy => true}${4:, :reject_if => proc \{ |obj| ${5:obj.blank?} \}}}
@ -227,31 +225,31 @@ assert_response :${1:success}, @response.body$0
endsnippet endsnippet
snippet aftc "after_create" snippet aftc "after_create"
after_create after_create $0
endsnippet endsnippet
snippet aftd "after_destroy" snippet aftd "after_destroy"
after_destroy after_destroy $0
endsnippet endsnippet
snippet afts "after_save" snippet afts "after_save"
after_save after_save $0
endsnippet endsnippet
snippet aftu "after_update" snippet aftu "after_update"
after_update after_update $0
endsnippet endsnippet
snippet aftv "after_validation" snippet aftv "after_validation"
after_validation after_validation $0
endsnippet endsnippet
snippet aftvoc "after_validation_on_create" snippet aftvoc "after_validation_on_create"
after_validation_on_create after_validation_on_create $0
endsnippet endsnippet
snippet aftvou "after_validation_on_update" snippet aftvou "after_validation_on_update"
after_validation_on_update after_validation_on_update $0
endsnippet endsnippet
snippet asg "assert(var = assigns(:var))" snippet asg "assert(var = assigns(:var))"
@ -298,27 +296,27 @@ end}
endsnippet endsnippet
snippet befc "before_create" snippet befc "before_create"
before_create before_create $0
endsnippet endsnippet
snippet befd "before_destroy" snippet befd "before_destroy"
before_destroy before_destroy $0
endsnippet endsnippet
snippet befs "before_save" snippet befs "before_save"
before_save before_save $0
endsnippet endsnippet
snippet befu "before_update" snippet befu "before_update"
before_update before_update $0
endsnippet endsnippet
snippet befv "before_validation" snippet befv "before_validation"
before_validation before_validation $0
endsnippet endsnippet
snippet befvoc "before_validation_on_create" snippet befvoc "before_validation_on_create"
before_validation_on_create before_validation_on_create $0
endsnippet endsnippet
snippet befvou "before_validation_on_update" snippet befvou "before_validation_on_update"

View File

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
priority -50
########################################################################### ###########################################################################
# General Stuff # # General Stuff #
########################################################################### ###########################################################################
@ -52,7 +54,7 @@ def has_cjk(char):
return True return True
def real_filename(filename): def real_filename(filename):
"""peal extension name off if possible """pealeextension name off if possible
# i.e. "foo.bar.png will return "foo.bar" # i.e. "foo.bar.png will return "foo.bar"
""" """
return ospath.splitext(filename)[0] return ospath.splitext(filename)[0]

View File

@ -1,3 +1,5 @@
priority -50
snippet "^#!" "#!/usr/bin/env ruby" r snippet "^#!" "#!/usr/bin/env ruby" r
#!/usr/bin/env ruby #!/usr/bin/env ruby
$0 $0
@ -25,7 +27,7 @@ endsnippet
snippet if "if <condition> ... end" snippet if "if <condition> ... end"
if ${1:condition} if ${1:condition}
${2} ${2:# TODO}
end end
endsnippet endsnippet
@ -33,9 +35,9 @@ endsnippet
snippet ife "if <condition> ... else ... end" snippet ife "if <condition> ... else ... end"
if ${1:condition} if ${1:condition}
${2} ${2:# TODO}
else else
${3} ${3:# TODO}
end end
endsnippet endsnippet
@ -43,11 +45,11 @@ endsnippet
snippet ifee "if <condition> ... elseif <condition> ... else ... end" snippet ifee "if <condition> ... elseif <condition> ... else ... end"
if ${1:condition} if ${1:condition}
${2} ${2:# TODO}
elsif ${3:condition} elsif ${3:condition}
${4} ${4:# TODO}
else else
${0} ${0:# TODO}
end end
endsnippet endsnippet
@ -55,7 +57,7 @@ endsnippet
snippet unless "unless <condition> ... end" snippet unless "unless <condition> ... end"
unless ${1:condition} unless ${1:condition}
${0} ${0:# TODO}
end end
endsnippet endsnippet
@ -63,9 +65,9 @@ endsnippet
snippet unlesse "unless <condition> ... else ... end" snippet unlesse "unless <condition> ... else ... end"
unless ${1:condition} unless ${1:condition}
${2} ${2:# TODO}
else else
${0} ${0:# TODO}
end end
endsnippet endsnippet
@ -73,11 +75,11 @@ endsnippet
snippet unlesee "unless <condition> ... elseif <condition> ... else ... end" snippet unlesee "unless <condition> ... elseif <condition> ... else ... end"
unless ${1:condition} unless ${1:condition}
${2} ${2:# TODO}
elsif ${3:condition} elsif ${3:condition}
${4} ${4:# TODO}
else else
${0} ${0:# TODO}
end end
endsnippet endsnippet
@ -85,7 +87,7 @@ endsnippet
snippet "\b(de)?f" "def <name>..." r snippet "\b(de)?f" "def <name>..." r
def ${1:function_name}${2: ${3:*args}} def ${1:function_name}${2: ${3:*args}}
${0} ${0:# TODO}
end end
endsnippet endsnippet
@ -93,7 +95,7 @@ endsnippet
snippet defi "def initialize ..." snippet defi "def initialize ..."
def initialize${1: ${2:*args}} def initialize${1: ${2:*args}}
${0} ${0:# TODO}
end end
endsnippet endsnippet
@ -101,23 +103,23 @@ endsnippet
snippet defr "def <name> ... rescue ..." snippet defr "def <name> ... rescue ..."
def ${1:function_name}${2: ${3:*args}} def ${1:function_name}${2: ${3:*args}}
${4} ${4:# TODO}
rescue rescue
${0} ${0:# TODO}
end end
endsnippet endsnippet
snippet For "(<from>..<to>).each { |<i>| <block> }" snippet For "(<from>..<to>).each { |<i>| <block> }"
(${1:from}..${2:to}).each { |${3:i}| ${4} } (${1:from}..${2:to}).each { |${3:i}| ${4:# TODO} }
endsnippet endsnippet
snippet for "(<from>..<to>).each do |<i>| <block> end" snippet for "(<from>..<to>).each do |<i>| <block> end"
(${1:from}..${2:to}).each do |${3:i}| (${1:from}..${2:to}).each do |${3:i}|
${0} ${0:# TODO}
end end
endsnippet endsnippet
@ -138,42 +140,42 @@ endsnippet
snippet "(\S+)\.Del(ete)?_?if" ".delete_if { |<key>,<value>| <block> }" r snippet "(\S+)\.Del(ete)?_?if" ".delete_if { |<key>,<value>| <block> }" r
`!p snip.rv=match.group(1)`.delete_if { |${1:key},${2:value}| ${3} } `!p snip.rv=match.group(1)`.delete_if { |${1:key},${2:value}| ${3:# TODO} }
endsnippet endsnippet
snippet "(\S+)\.del(ete)?_?if" ".delete_if do |<key>,<value>| <block> end" r snippet "(\S+)\.del(ete)?_?if" ".delete_if do |<key>,<value>| <block> end" r
`!p snip.rv=match.group(1)`.delete_if do |${1:key},${2:value}| `!p snip.rv=match.group(1)`.delete_if do |${1:key},${2:value}|
${0} ${0:# TODO}
end end
endsnippet endsnippet
snippet "(\S+)\.Keep_?if" ".keep_if { |<key>,<value>| <block> }" r snippet "(\S+)\.Keep_?if" ".keep_if { |<key>,<value>| <block> }" r
`!p snip.rv=match.group(1)`.keep_if { |${1:key},${2:value}| ${3} } `!p snip.rv=match.group(1)`.keep_if { |${1:key},${2:value}| ${3:# TODO} }
endsnippet endsnippet
snippet "(\S+)\.keep_?if" ".keep_if do <key>,<value>| <block> end" r snippet "(\S+)\.keep_?if" ".keep_if do <key>,<value>| <block> end" r
`!p snip.rv=match.group(1)`.keep_if do |${1:key},${2:value}| `!p snip.rv=match.group(1)`.keep_if do |${1:key},${2:value}|
${0} ${0:# TODO}
end end
endsnippet endsnippet
snippet "(\S+)\.Reject" ".reject { |<key>,<value>| <block> }" r snippet "(\S+)\.Reject" ".reject { |<key>,<value>| <block> }" r
`!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| ${3} } `!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| ${3:# TODO} }
endsnippet endsnippet
snippet "(\S+)\.reject" ".reject do <key>,<value>| <block> end" r snippet "(\S+)\.reject" ".reject do <key>,<value>| <block> end" r
`!p snip.rv=match.group(1)`.reject do |${1:key},${2:value}| `!p snip.rv=match.group(1)`.reject do |${1:key},${2:value}|
${0} ${0:# TODO}
end end
endsnippet endsnippet
@ -194,71 +196,71 @@ endsnippet
snippet "(\S+)\.Sort" ".sort { |<a>,<b>| <block> }" r snippet "(\S+)\.Sort" ".sort { |<a>,<b>| <block> }" r
`!p snip.rv=match.group(1)`.sort { |${1:a},${2:b}| ${3} } `!p snip.rv=match.group(1)`.sort { |${1:a},${2:b}| ${3:# TODO} }
endsnippet endsnippet
snippet "(\S+)\.sort" ".sort do |<a>,<b>| <block> end" r snippet "(\S+)\.sort" ".sort do |<a>,<b>| <block> end" r
`!p snip.rv=match.group(1)`.sort do |${1:a},${2:b}| `!p snip.rv=match.group(1)`.sort do |${1:a},${2:b}|
${0} ${0:# TODO}
end end
endsnippet endsnippet
snippet "(\S+)\.Each_?k(ey)?" ".each_key { |<key>| <block> }" r snippet "(\S+)\.Each_?k(ey)?" ".each_key { |<key>| <block> }" r
`!p snip.rv=match.group(1)`.each_key { |${1:key}| ${2} } `!p snip.rv=match.group(1)`.each_key { |${1:key}| ${2:# TODO} }
endsnippet endsnippet
snippet "(\S+)\.each_?k(ey)?" ".each_key do |key| <block> end" r snippet "(\S+)\.each_?k(ey)?" ".each_key do |key| <block> end" r
`!p snip.rv=match.group(1)`.each_key do |${1:key}| `!p snip.rv=match.group(1)`.each_key do |${1:key}|
${0} ${0:# TODO}
end end
endsnippet endsnippet
snippet "(\S+)\.Each_?val(ue)?" ".each_value { |<value>| <block> }" r snippet "(\S+)\.Each_?val(ue)?" ".each_value { |<value>| <block> }" r
`!p snip.rv=match.group(1)`.each_value { |${1:value}| ${2} } `!p snip.rv=match.group(1)`.each_value { |${1:value}| ${2:# TODO} }
endsnippet endsnippet
snippet "(\S+)\.each_?val(ue)?" ".each_value do |<value>| <block> end" r snippet "(\S+)\.each_?val(ue)?" ".each_value do |<value>| <block> end" r
`!p snip.rv=match.group(1)`.each_value do |${1:value}| `!p snip.rv=match.group(1)`.each_value do |${1:value}|
${0} ${0:# TODO}
end end
endsnippet endsnippet
snippet Each "<elements>.each { |<element>| <block> }" snippet Each "<elements>.each { |<element>| <block> }"
${1:elements}.each { |${2:${1/s$//}}| ${3} } ${1:elements}.each { |${2:${1/s$//}}| ${3:# TODO} }
endsnippet endsnippet
snippet each "<elements>.each do |<element>| <block> end" snippet each "<elements>.each do |<element>| <block> end"
${1:elements}.each do |${2:${1/s$//}}| ${1:elements}.each do |${2:${1/s$//}}|
${0} ${0:# TODO}
end end
endsnippet endsnippet
snippet each_?s(lice)? "<array>.each_slice(n) do |slice| <block> end" snippet "each_?s(lice)?" "<array>.each_slice(n) do |slice| <block> end" r
each_slice(${1:2}) do |${2:slice}| ${1:elements}.each_slice(${2:2}) do |${3:slice}|
${0} ${0:# TODO}
end end
endsnippet endsnippet
snippet Each_?s(lice)? "<array>.each_slice(n) { |slice| <block> }" snippet "Each_?s(lice)?" "<array>.each_slice(n) { |slice| <block> }" r
each_slice(${1:2}) { |${2:slice}| ${3} } ${1:elements}.each_slice(${2:2}) { |${3:slice}| ${0:# TODO} }
endsnippet endsnippet
@ -273,7 +275,7 @@ try:
snip.rv = wmatch.group(1).lower() snip.rv = wmatch.group(1).lower()
except: except:
snip.rv = 'element' snip.rv = 'element'
`}| ${2} } `}| ${2:# TODO} }
endsnippet endsnippet
@ -288,7 +290,7 @@ try:
except: except:
snip.rv = 'element' snip.rv = 'element'
`}| `}|
${0} ${0:# TODO}
end end
endsnippet endsnippet
@ -303,7 +305,7 @@ try:
snip.rv = wmatch.group(1).lower() snip.rv = wmatch.group(1).lower()
except: except:
snip.rv = 'element' snip.rv = 'element'
`}| ${2} } `}| ${2:# TODO} }
endsnippet endsnippet
@ -318,7 +320,7 @@ try:
except: except:
snip.rv = 'element' snip.rv = 'element'
`}| `}|
${0} ${0:# TODO}
end end
endsnippet endsnippet
@ -333,7 +335,7 @@ try:
snip.rv = wmatch.group(1).lower() snip.rv = wmatch.group(1).lower()
except: except:
snip.rv = 'element' snip.rv = 'element'
`}| ${2} } `}| ${2:# TODO} }
endsnippet endsnippet
@ -348,14 +350,14 @@ try:
except: except:
snip.rv = 'element' snip.rv = 'element'
`}| `}|
${0} ${0:# TODO}
end end
endsnippet endsnippet
snippet "(\S+)\.Each_w(ith)?_?i(ndex)?" ".each_with_index { |<element>,<i>| <block> }" r snippet "(\S+)\.Each_?w(ith)?_?i(ndex)?" ".each_with_index { |<element>,<i>| <block> }" r
`!p snip.rv=match.group(1)`.each_with_index { |${1:`!p `!p snip.rv=match.group(1)`.each_with_index { |${1:`!p
element_name = match.group(1).lstrip('$@') element_name = match.group(1).lstrip('$@')
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name) ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
@ -364,7 +366,7 @@ try:
snip.rv = wmatch.group(1).lower() snip.rv = wmatch.group(1).lower()
except: except:
snip.rv = 'element' snip.rv = 'element'
`},${2:i}| ${3} }$0 `},${2:i}| ${3:# TODO} }$0
endsnippet endsnippet
@ -379,7 +381,7 @@ try:
except: except:
snip.rv = 'element' snip.rv = 'element'
`},${2:i}| `},${2:i}|
${0} ${0:# TODO}
end end
endsnippet endsnippet
@ -387,14 +389,14 @@ endsnippet
snippet "(\S+)\.Each_?p(air)?" ".each_pair { |<key>,<value>| <block> }" r snippet "(\S+)\.Each_?p(air)?" ".each_pair { |<key>,<value>| <block> }" r
`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| ${3} } `!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| ${3:# TODO} }
endsnippet endsnippet
snippet "(\S+)\.each_?p(air)?" ".each_pair do |<key>,<value>| <block> end" r snippet "(\S+)\.each_?p(air)?" ".each_pair do |<key>,<value>| <block> end" r
`!p snip.rv=match.group(1)`.each_pair do |${1:key},${2:value}| `!p snip.rv=match.group(1)`.each_pair do |${1:key},${2:value}|
${0} ${0:# TODO}
end end
endsnippet endsnippet
@ -424,24 +426,26 @@ snippet "(\S+)\.Index" ".index do |item| ... end" r
end end
endsnippet endsnippet
# comments about do and dov see snippets/ruby.snippets
snippet do "do ... end" i
snippet do "do |<key>| ... end" i
do |${1:args}|
$0
end
endsnippet
snippet Do "do ... end" i
do do
$0 $0
end end
endsnippet endsnippet
snippet dov "do |<key>| ... end" i
do |${1:v}|
$2
end
endsnippet
snippet until "until <expression> ... end" snippet until "until <expression> ... end"
until ${1:expression} until ${1:expression}
${0} ${0:# TODO}
end end
endsnippet endsnippet
@ -449,15 +453,15 @@ endsnippet
snippet Until "begin ... end until <expression>" snippet Until "begin ... end until <expression>"
begin begin
${0} ${0:# TODO}
end until ${1:expression} end until ${1:expression}
endsnippet endsnippet
snippet wh "while <expression> ... end" snippet while "while <expression> ... end"
while ${1:expression} while ${1:expression}
${0} ${0:# TODO}
end end
endsnippet endsnippet
@ -465,7 +469,7 @@ endsnippet
snippet While "begin ... end while <expression>" snippet While "begin ... end while <expression>"
begin begin
${0} ${0:# TODO}
end while ${1:expression} end while ${1:expression}
endsnippet endsnippet
@ -491,9 +495,9 @@ endsnippet
snippet begin "begin ... rescue ... end" snippet begin "begin ... rescue ... end"
begin begin
${1} ${1:# TODO}
rescue rescue
${0} ${0:# TODO}
end end
endsnippet endsnippet

55
UltiSnips/scss.snippets Normal file
View File

@ -0,0 +1,55 @@
priority -50
snippet /@?imp/ "@import '...';" br
@import '${1:file}';
endsnippet
snippet /@?inc/ "@include mixin(...);" br
@include ${1:mixin}(${2:arguments});
endsnippet
snippet /@?ext?/ "@extend %placeholder;" br
@extend %${1:placeholder};
endsnippet
snippet /@?mixin/ "@mixin (...) { ... }" br
@mixin ${1:name}(${2:arguments}) {
${VISUAL}$0
}
endsnippet
snippet /@?fun/ "@function (...) { ... }" br
@function ${1:name}(${2:arguments}) {
${VISUAL}$0
}
endsnippet
snippet /@?if/ "@if (...) { ... }" br
@if ${1:condition} {
${VISUAL}$0
}
endsnippet
snippet /(} )?@?else/ "@else { ... }" br
@else ${1:condition} {
${VISUAL}$0
}
endsnippet
snippet /@?for/ "@for loop" br
@for ${1:$i} from ${2:1} through ${3:3} {
${VISUAL}$0
}
endsnippet
snippet /@?each/ "@each loop" br
@each ${1:$item} in ${2:item, item, item} {
${VISUAL}$0
}
endsnippet
snippet /@?while/ "@while loop" br
@while ${1:$i} ${2:>} ${3:0} {
${VISUAL}$0
}
endsnippet

View File

@ -1,3 +1,5 @@
priority -50
global !p global !p
import vim import vim
@ -10,10 +12,12 @@ def testShell(scope, shell):
# first since they indicate an override by the user. # first since they indicate an override by the user.
def getShell(): def getShell():
for scope in ["g", "b"]: for scope in ["g", "b"]:
for shell in ["bash", "sh", "kornshell"]: for shell in ["bash", "posix", "sh", "kornshell"]:
if testShell(scope, shell) == "1": if testShell(scope, shell) == "1":
if shell == "kornshell": if shell == "kornshell":
return "ksh" return "ksh"
if shell == "posix":
return "sh"
return shell return shell
return "sh" return "sh"
endglobal endglobal
@ -79,7 +83,7 @@ until ${2:[[ ${1:condition} ]]}; do
done done
endsnippet endsnippet
snippet wh "while ... (done)" snippet while "while ... (done)"
while ${2:[[ ${1:condition} ]]}; do while ${2:[[ ${1:condition} ]]}; do
${0:#statements} ${0:#statements}
done done

View File

@ -1,16 +1,14 @@
######################### priority -50
# SNIPPETS for SNIPPETS #
#########################
# We use a little hack so that the snippet is expanded # We use a little hack so that the snippet is expanded
# and parsed correctly # and parsed correctly
snippet snip "Snippet definition" ! snippet snip "Snippet definition" b
`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:!b} `!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:b}
$0 $0
`!p snip.rv = "endsnippet"` `!p snip.rv = "endsnippet"`
endsnippet endsnippet
snippet global "Global snippet" ! snippet global "Global snippet" b
`!p snip.rv = "global"` !p `!p snip.rv = "global"` !p
$0 $0
`!p snip.rv = "endglobal"` `!p snip.rv = "endglobal"`

View File

@ -1,3 +1,5 @@
priority -50
########################################################################### ###########################################################################
# TEXTMATE SNIPPETS # # TEXTMATE SNIPPETS #
########################################################################### ###########################################################################
@ -16,14 +18,14 @@ foreach ${1:var} ${2:\$list} {
endsnippet endsnippet
snippet if "if... (if)" b snippet if "if... (if)" b
if {${1}} { if {${1:condition}} {
${2} ${2}
} }
endsnippet endsnippet
snippet proc "proc... (proc)" b snippet proc "proc... (proc)" b
proc ${1} {${2}} \ proc ${1:name} {${2:args}} \
{ {
${3} ${3}
} }
@ -40,8 +42,8 @@ switch ${1:-exact} -- ${2:\$var} {
endsnippet endsnippet
snippet wh "while... (while)" b snippet while "while... (while)" b
while {${1}} { while {${1:condition}} {
${2} ${2}
} }

View File

@ -1,38 +1,28 @@
priority -50
########################################################################### extends texmath
# LATEX SNIPPETS #
###########################################################################
snippet r "\ref{}" w
\ref{$1}
endsnippet
###########################################################################
# TEXTMATE SNIPPETS #
###########################################################################
#################
# GENERAL STUFF #
#################
snippet "b(egin)?" "begin{} / end{}" br snippet "b(egin)?" "begin{} / end{}" br
\begin{${1:something}} \begin{${1:something}}
${0:${VISUAL}} ${0:${VISUAL}}
\end{$1} \end{$1}
endsnippet endsnippet
####################
# TABULARS, ARRAYS #
####################
snippet tab snippet tab
\begin{${1:t}${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${2:c}} \begin{${1:t}${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${2:c}}
$0${2/((?<=.)c|l|r)|./(?1: & )/g} $0${2/((?<=.)c|l|r)|./(?1: & )/g}
\end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}} \end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}
endsnippet endsnippet
######################## snippet fig "Figure environment" b
# ENUM, DESCR, ITEMIZE # \begin{figure}${2:[htpb]}
######################## \centering
\includegraphics[width=${3:0.8}\linewidth]{${4:name.ext}}
\caption{${4/(\w+)\.\w+/\u$1/}$0}
\label{fig:${4/(\w+)\.\w+/$1/}}
\end{figure}
endsnippet
snippet enum "Enumerate" b snippet enum "Enumerate" b
\begin{enumerate} \begin{enumerate}
\item $0 \item $0
@ -51,74 +41,70 @@ snippet desc "Description" b
\end{description} \end{description}
endsnippet endsnippet
##################################### snippet it "Individual item" b
# SECTIONS, CHAPTERS AND THERE LIKE # \item ${1}
##################################### $0
endsnippet
snippet part "Part" b snippet part "Part" b
\part{${1:part name}} \part{${1:part name}}
\label{prt:${2:${1/(\w+)|\W+/(?1:\L$0\E:_)/g}}} \label{prt:${2:${1/(\w+)|\W+/(?1:\L$0\E:_)/ga}}}
${0} ${0}
% part $2 (end)
endsnippet endsnippet
snippet cha "Chapter" b snippet cha "Chapter" b
\chapter{${1:chapter name}} \chapter{${1:chapter name}}
\label{cha:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} \label{cha:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0} ${0}
% chapter $2 (end)
endsnippet endsnippet
snippet sec "Section" b snippet sec "Section" b
\section{${1:section name}} \section{${1:section name}}
\label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} \label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0} ${0}
% section $2 (end)
endsnippet endsnippet
snippet sub "Subsection" b snippet sub "Subsection" b
\subsection{${1:subsection name}} \subsection{${1:subsection name}}
\label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} \label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0} ${0}
% subsection $2 (end)
endsnippet endsnippet
snippet ssub "Subsubsection" b snippet ssub "Subsubsection" b
\subsubsection{${1:subsubsection name}} \subsubsection{${1:subsubsection name}}
\label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} \label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0} ${0}
% subsubsection $2 (end)
endsnippet endsnippet
snippet par "Paragraph" b snippet par "Paragraph" b
\paragraph{${1:paragraph name}} \paragraph{${1:paragraph name}}
\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} \label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0} ${0}
% paragraph $2 (end)
endsnippet endsnippet
snippet subp "Subparagraph" b snippet subp "Subparagraph" b
\subparagraph{${1:subparagraph name}} \subparagraph{${1:subparagraph name}}
\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} \label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0} ${0}
% subparagraph $2 (end)
endsnippet endsnippet
snippet ni "Non-indented paragraph" b
\noindent
${0}
endsnippet
snippet pac "Package" b
\usepackage[${1:options}]{${2:package}}$0
endsnippet
snippet lp "Long parenthesis"
\left(${1:${VISUAL:contents}}\right)$0
endsnippet
# vim:ft=snippets: # vim:ft=snippets:

View File

@ -1,3 +1,5 @@
priority -50
############## ##############
# MATH STUFF # # MATH STUFF #
############## ##############

View File

@ -1,3 +1,5 @@
priority -50
snippet bl "twig block" b snippet bl "twig block" b
{% block ${1} %} {% block ${1} %}
${2} ${2}

View File

@ -1,3 +1,5 @@
priority -50
########################################################################### ###########################################################################
# SnipMate Snippets # # SnipMate Snippets #
########################################################################### ###########################################################################
@ -25,30 +27,30 @@ endsnippet
snippet f snippet f
fun ${1:function_name}(${2}) fun ${1:function_name}(${2})
${3} ${3:" code}
endf endf
endsnippet endsnippet
snippet for snippet for
for ${1} in ${2} for ${1:needle} in ${2:haystack}
${3} ${3:" code}
endfor endfor
endsnippet endsnippet
snippet wh snippet wh
while ${1} while ${1:condition}
${2} ${2:" code}
endw endw
endsnippet endsnippet
snippet if snippet if
if ${1} if ${1:condition}
${2} ${2:" code}
endif endif
endsnippet endsnippet
snippet ife snippet ife
if ${1} if ${1:condition}
${2} ${2}
else else
${3} ${3}

View File

@ -0,0 +1,3 @@
priority -50
extends html

View File

@ -1,3 +1,10 @@
priority -50
snippet xml "XML declaration" b
<?xml version="1.0"?>
endsnippet
snippet t "Simple tag" b snippet t "Simple tag" b
<${1:tag}> <${1:tag}>
${2:content} ${2:content}

View File

@ -1,9 +1,15 @@
snippet #! "shebang" ! priority -50
extends sh
priority -49
snippet #! "shebang" b
#!/bin/zsh #!/bin/zsh
endsnippet endsnippet
snippet !env "#!/usr/bin/env (!env)" ! snippet !env "#!/usr/bin/env (!env)" b
#!/usr/bin/env zsh #!/usr/bin/env zsh
endsnippet endsnippet