mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins
This commit is contained in:
@ -60,6 +60,24 @@ improved by Adnan Zafar. So maybe time is not ready to make a final decision yet
|
||||
|
||||
[github issue/discussion](https://github.com/honza/vim-snippets/issues/363)
|
||||
|
||||
Vendor Snippets
|
||||
---------------
|
||||
|
||||
Additional library and framework snippets are available for UltiSnips users in
|
||||
the `UltiSnips/` directory. These files are removed from the default language
|
||||
namespaces to prevent them from all being loaded automatically. If there is a
|
||||
separate library, framework, or package you would like to support open a pull
|
||||
request!
|
||||
|
||||
Additional snippets can be added to the current buffer with the
|
||||
`:UltiSnipsAddFiletypes` command followed by the snippet name without the
|
||||
"snippets" ending. For example, to add the JavaScript Jasmine snippets, run:
|
||||
`:UltiSnipsAddFiletypes javascript-jasmine`. To have this snippet loaded
|
||||
everytime a JavaScript file is opened or created you can add the command to your
|
||||
`.vim/ftplugin/javascript.vim` file.
|
||||
|
||||
For more see the UltiSnips docs (`:help UltiSnips`).
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
@ -216,6 +234,7 @@ This list is kept up-to-date on a best effort basis.
|
||||
* Python - [honza](http://github.com/honza)
|
||||
* Ruby - [taq](http://github.com/taq)
|
||||
* Scala - [gorodinskiy](https://github.com/gorodinskiy)
|
||||
* Supercollider - [lpil](https://github.com/lpil)
|
||||
|
||||
License
|
||||
-------
|
||||
|
@ -10,69 +10,7 @@ priority -60
|
||||
# NICE BOXES #
|
||||
##############
|
||||
global !p
|
||||
import string, vim
|
||||
|
||||
""" Maps a filetype to comment format used for boxes.
|
||||
Automatically filled during usage"""
|
||||
_commentDict = { }
|
||||
|
||||
def _parse_comments(s):
|
||||
""" Parses vim's comments option to extract comment format """
|
||||
i = iter(s.split(","))
|
||||
|
||||
rv = []
|
||||
try:
|
||||
while True:
|
||||
# get the flags and text of a comment part
|
||||
flags, text = next(i).split(':', 1)
|
||||
|
||||
if len(flags) == 0:
|
||||
rv.append((text, text, text, ""))
|
||||
# parse 3-part comment, but ignore those with O flag
|
||||
elif 's' in flags and 'O' not in flags:
|
||||
ctriple = []
|
||||
indent = ""
|
||||
|
||||
if flags[-1] in string.digits:
|
||||
indent = " " * int(flags[-1])
|
||||
ctriple.append(text)
|
||||
|
||||
flags,text = next(i).split(':', 1)
|
||||
assert(flags[0] == 'm')
|
||||
ctriple.append(text)
|
||||
|
||||
flags,text = next(i).split(':', 1)
|
||||
assert(flags[0] == 'e')
|
||||
ctriple.append(text)
|
||||
ctriple.append(indent)
|
||||
|
||||
rv.append(ctriple)
|
||||
elif 'b' in flags:
|
||||
if len(text) == 1:
|
||||
rv.insert(0, (text,text,text, ""))
|
||||
except StopIteration:
|
||||
return rv
|
||||
|
||||
def _get_comment_format():
|
||||
""" Returns a 4-element tuple representing the comment format for
|
||||
the current file. """
|
||||
return _parse_comments(vim.eval("&comments"))[0]
|
||||
|
||||
|
||||
def make_box(twidth, bwidth=None):
|
||||
b, m, e, i = _get_comment_format()
|
||||
bwidth_inner = bwidth - 3 - max(len(b), len(i + e)) if bwidth else twidth + 2
|
||||
sline = b + m + bwidth_inner * m[0] + 2 * m[0]
|
||||
nspaces = (bwidth_inner - twidth) // 2
|
||||
mlines = i + m + " " + " " * nspaces
|
||||
mlinee = " " + " "*(bwidth_inner - twidth - nspaces) + m
|
||||
eline = i + m + bwidth_inner * m[0] + 2 * m[0] + e
|
||||
return sline, mlines, mlinee, eline
|
||||
|
||||
def foldmarker():
|
||||
"Return a tuple of (open fold marker, close fold marker)"
|
||||
return vim.eval("&foldmarker").split(",")
|
||||
|
||||
from vimsnippets import foldmarker, make_box, get_comment_format
|
||||
endglobal
|
||||
|
||||
snippet box "A nice box with the current comment symbol" b
|
||||
@ -102,17 +40,17 @@ $0
|
||||
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]`
|
||||
`!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]`
|
||||
`!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]`
|
||||
`!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]`
|
||||
`!p snip.rv = get_comment_format()[0]` `!p snip.rv = foldmarker()[1]` $1 `!p snip.rv = get_comment_format()[2]`
|
||||
endsnippet
|
||||
|
||||
##########################
|
||||
|
@ -11,7 +11,7 @@ endsnippet
|
||||
snippet ifndef "#ifndef ... #define ... #endif"
|
||||
#ifndef ${1/([A-Za-z0-9_]+).*/$1/}
|
||||
#define ${1:SYMBOL} ${2:value}
|
||||
#endif
|
||||
#endif /* ifndef $1 */
|
||||
endsnippet
|
||||
|
||||
snippet #if "#if #endif" b
|
||||
@ -20,14 +20,6 @@ ${VISUAL}${0}
|
||||
#endif
|
||||
endsnippet
|
||||
|
||||
snippet inc "#include local header (inc)"
|
||||
#include "${1:`!p snip.rv = snip.basename + '.h'`}"
|
||||
endsnippet
|
||||
|
||||
snippet Inc "#include <> (Inc)"
|
||||
#include <${1:.h}>
|
||||
endsnippet
|
||||
|
||||
snippet mark "#pragma mark (mark)"
|
||||
#if 0
|
||||
${1:#pragma mark -
|
||||
@ -57,10 +49,6 @@ for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) {
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet enum "Enumeration"
|
||||
enum ${1:name} { $0 };
|
||||
endsnippet
|
||||
|
||||
snippet once "Include header once only guard"
|
||||
#ifndef ${1:`!p
|
||||
if not snip.c:
|
||||
@ -77,22 +65,6 @@ ${VISUAL}${0}
|
||||
#endif /* end of include guard: $1 */
|
||||
endsnippet
|
||||
|
||||
snippet td "Typedef"
|
||||
typedef ${1:int} ${2:MyCustomType};
|
||||
endsnippet
|
||||
|
||||
snippet wh "while loop"
|
||||
while(${1:/* condition */}) {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet do "do...while loop (do)"
|
||||
do {
|
||||
${VISUAL}${0}
|
||||
} while(${1:/* condition */});
|
||||
endsnippet
|
||||
|
||||
snippet fprintf "fprintf ..."
|
||||
fprintf(${1:stderr}, "${2:%s}\n"${2/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$3${2/([^%]|%%)*(%.)?.*/(?2:\);)/}
|
||||
endsnippet
|
||||
|
@ -0,0 +1,80 @@
|
||||
#
|
||||
# CoffeeScript versions -- adapted from coffee-jasmine
|
||||
# for some ReactJS matchers.
|
||||
#
|
||||
priority -50
|
||||
|
||||
extends coffee
|
||||
|
||||
priority -49
|
||||
|
||||
snippet createClass "React define Class" b
|
||||
${1:classname}Class = React.createClass
|
||||
displayName: "$1"
|
||||
render: ->
|
||||
${2}
|
||||
$1 = React.createFactory($1)
|
||||
endsnippet
|
||||
|
||||
snippet PropTypes "React define propTypes" b
|
||||
propTypes: ->
|
||||
${1:myVar}: React.PropTypes.${2:type}${3:.isRequired}
|
||||
endsnippet
|
||||
|
||||
snippet propType "React propType (key/value)" b
|
||||
${1:myVar}: React.PropTypes.${2:type}${3:.isRequired}
|
||||
${4}
|
||||
endsnippet
|
||||
|
||||
snippet setState "React setState" b
|
||||
@setState
|
||||
${1:myvar}: ${2:myvalue}
|
||||
${3}
|
||||
endsnippet
|
||||
|
||||
snippet getInitialState "React define getInitialState" b
|
||||
getInitialState: ->
|
||||
${1:myvar}: ${2:myvalue}
|
||||
${3}
|
||||
endsnippet
|
||||
|
||||
snippet getDefaultProps "React define getDefaultProps" b
|
||||
getDefaultProps: ->
|
||||
${1:myvar}: ${2:myvalue}
|
||||
${3}
|
||||
endsnippet
|
||||
|
||||
snippet componentWillMount "React define componentWillMount" b
|
||||
componentWillMount: ->
|
||||
${1}
|
||||
endsnippet
|
||||
|
||||
snippet componentDidMount "React define componentDidMount" b
|
||||
componentDidMount: ->
|
||||
${1}
|
||||
endsnippet
|
||||
|
||||
snippet componentWillReceiveProps "React define componentWillReceiveProps" b
|
||||
componentWillReceiveProps: (nextProps) ->
|
||||
${1}
|
||||
endsnippet
|
||||
|
||||
snippet shouldComponentUpdate "React define shouldComponentUpdate" b
|
||||
shouldComponentUpdate: (nextProps, nextState) ->
|
||||
${1}
|
||||
endsnippet
|
||||
|
||||
snippet componentWillUpdate "React define componentWillUpdate" b
|
||||
componentWillUpdate: (nextProps, nextState) ->
|
||||
${1}
|
||||
endsnippet
|
||||
|
||||
snippet componentDidUpdate "React define componentDidUpdate" b
|
||||
componentDidUpdate: (prevProps, prevState) ->
|
||||
${1}
|
||||
endsnippet
|
||||
|
||||
snippet componentWillUnmount "React define componentWillUnmount" b
|
||||
componentWillUnmount: ->
|
||||
${1}
|
||||
endsnippet
|
@ -94,3 +94,7 @@ endsnippet
|
||||
snippet log "Log" b
|
||||
console.log ${1:"${2:msg}"}
|
||||
endsnippet
|
||||
|
||||
snippet kv "Key:value for object" b
|
||||
${1:key}:${2:value}
|
||||
endsnippet
|
||||
|
@ -1,238 +1,361 @@
|
||||
priority -50
|
||||
|
||||
# Generic Tags
|
||||
snippet %
|
||||
{% ${1} %}${2}
|
||||
# This files will define django snippets from sublime text djaneiro
|
||||
# FORMS SNIPPETS
|
||||
|
||||
snippet form "Form" b
|
||||
class ${1:FORMNAME}(forms.Form):
|
||||
|
||||
${2:# TODO: Define form fields here}
|
||||
endsnippet
|
||||
|
||||
snippet %%
|
||||
{% ${1:tag_name} %}
|
||||
${2}
|
||||
{% end$1 %}
|
||||
snippet modelform "ModelForm" b
|
||||
class ${1:MODELNAME}Form(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = $1
|
||||
endsnippet
|
||||
|
||||
snippet {
|
||||
{{ ${1} }}${2}
|
||||
snippet fbool "BooleanField" b
|
||||
${1:FIELDNAME} = forms.BooleanField($2)
|
||||
endsnippet
|
||||
|
||||
# Template Tags
|
||||
|
||||
snippet autoescape
|
||||
{% autoescape ${1:off} %}
|
||||
${2}
|
||||
{% endautoescape %}
|
||||
snippet fchar "CharField" b
|
||||
${1:FIELDNAME} = forms.CharField($2)
|
||||
endsnippet
|
||||
|
||||
snippet block
|
||||
{% block ${1} %}
|
||||
${2}
|
||||
{% endblock $1 %}
|
||||
snippet fchoice "ChoiceField" b
|
||||
${1:FIELDNAME} = forms.ChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet #
|
||||
{# ${1:comment} #}
|
||||
snippet fcombo "ComboField" b
|
||||
${1:FIELDNAME} = forms.ComboField($2)
|
||||
endsnippet
|
||||
|
||||
snippet comment
|
||||
{% comment %}
|
||||
${1}
|
||||
{% endcomment %}
|
||||
snippet fdate "DateField" b
|
||||
${1:FIELDNAME} = forms.DateField($2)
|
||||
endsnippet
|
||||
|
||||
snippet cycle
|
||||
{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %}
|
||||
snippet fdatetime "DateTimeField" b
|
||||
${1:FIELDNAME} = forms.DateTimeField($2)
|
||||
endsnippet
|
||||
|
||||
snippet debug
|
||||
{% debug %}
|
||||
snippet fdecimal "DecimalField" b
|
||||
${1:FIELDNAME} = forms.DecimalField($2)
|
||||
endsnippet
|
||||
|
||||
snippet extends
|
||||
{% extends "${1:base.html}" %}
|
||||
snippet fmail "EmailField" b
|
||||
${1:FIELDNAME} = forms.EmailField($2)
|
||||
endsnippet
|
||||
|
||||
snippet filter
|
||||
{% filter ${1} %}
|
||||
${2}
|
||||
{% endfilter %}
|
||||
snippet ffile "FileField" b
|
||||
${1:FIELDNAME} = forms.FileField($2)
|
||||
endsnippet
|
||||
|
||||
snippet firstof
|
||||
{% firstof ${1} %}
|
||||
snippet ffilepath "FilePathField" b
|
||||
${1:FIELDNAME} = forms.FilePathField($2)
|
||||
endsnippet
|
||||
|
||||
snippet for
|
||||
{% for ${1} in ${2} %}
|
||||
${3}
|
||||
{% endfor %}
|
||||
snippet ffloat "FloatField" b
|
||||
${1:FIELDNAME} = forms.FloatField($2)
|
||||
endsnippet
|
||||
|
||||
snippet empty
|
||||
{% empty %}
|
||||
${1}
|
||||
snippet fip "IPAddressField" b
|
||||
${1:FIELDNAME} = forms.IPAddressField($2)
|
||||
endsnippet
|
||||
|
||||
snippet if
|
||||
{% if ${1} %}
|
||||
${2}
|
||||
{% endif %}
|
||||
snippet fimg "ImageField" b
|
||||
${1:FIELDNAME} = forms.ImageField($2)
|
||||
endsnippet
|
||||
|
||||
snippet else
|
||||
{% else %}
|
||||
${1}
|
||||
snippet fint "IntegerField" b
|
||||
${1:FIELDNAME} = forms.IntegerField($2)
|
||||
endsnippet
|
||||
|
||||
snippet ifchanged
|
||||
{% ifchanged %}${1}{% endifchanged %}
|
||||
snippet fmochoice "ModelChoiceField" b
|
||||
${1:FIELDNAME} = forms.ModelChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet ifequal
|
||||
{% ifequal ${1} ${2} %}
|
||||
${3}
|
||||
{% endifequal %}
|
||||
snippet fmomuchoice "ModelMultipleChoiceField" b
|
||||
${1:FIELDNAME} = forms.ModelMultipleChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet ifnotequal
|
||||
{% ifnotequal ${1} ${2} %}
|
||||
${3}
|
||||
{% endifnotequal %}
|
||||
snippet fmuval "MultiValueField" b
|
||||
${1:FIELDNAME} = forms.MultiValueField($2)
|
||||
endsnippet
|
||||
|
||||
snippet include
|
||||
{% include "${1}" %}
|
||||
snippet fmuchoice "MultipleChoiceField" b
|
||||
${1:FIELDNAME} = forms.MultipleChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet load
|
||||
{% load ${1} %}
|
||||
snippet fnullbool "NullBooleanField" b
|
||||
${1:FIELDNAME} = forms.NullBooleanField($2)
|
||||
endsnippet
|
||||
|
||||
snippet now
|
||||
{% now "${1:jS F Y H:i}" %}
|
||||
snippet freg "RegexField" b
|
||||
${1:FIELDNAME} = forms.RegexField($2)
|
||||
endsnippet
|
||||
|
||||
snippet regroup
|
||||
{% regroup ${1} by ${2} as ${3} %}
|
||||
snippet fslug "SlugField" b
|
||||
${1:FIELDNAME} = forms.SlugField($2)
|
||||
endsnippet
|
||||
|
||||
snippet spaceless
|
||||
{% spaceless %}${1}{% endspaceless %}
|
||||
snippet fsdatetime "SplitDateTimeField" b
|
||||
${1:FIELDNAME} = forms.SplitDateTimeField($2)
|
||||
endsnippet
|
||||
|
||||
snippet ssi
|
||||
{% ssi ${1} %}
|
||||
snippet ftime "TimeField" b
|
||||
${1:FIELDNAME} = forms.TimeField($2)
|
||||
endsnippet
|
||||
|
||||
snippet trans
|
||||
{% trans "${1:string}" %}
|
||||
snippet ftchoice "TypedChoiceField" b
|
||||
${1:FIELDNAME} = forms.TypedChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet url
|
||||
{% url ${1} as ${2} %}
|
||||
snippet ftmuchoice "TypedMultipleChoiceField" b
|
||||
${1:FIELDNAME} = forms.TypedMultipleChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet widthratio
|
||||
{% widthratio ${1:this_value} ${2:max_value} ${3:100} %}
|
||||
snippet furl "URLField" b
|
||||
${1:FIELDNAME} = forms.URLField($2)
|
||||
endsnippet
|
||||
|
||||
snippet with
|
||||
{% with ${1} as ${2} %}
|
||||
# MODELS SNIPPETS
|
||||
|
||||
snippet model "Model" b
|
||||
class ${1:MODELNAME}(models.Model):
|
||||
${0}
|
||||
class Meta:
|
||||
verbose_name = "$1"
|
||||
verbose_name_plural = "$1s"
|
||||
|
||||
def __str__(self):
|
||||
return super($1, self).__str__()
|
||||
|
||||
endsnippet
|
||||
|
||||
# Template Filters
|
||||
snippet modelfull "Model" b
|
||||
class ${1:MODELNAME}(models.Model):
|
||||
${2:# TODO: Define fields here}
|
||||
|
||||
# Note: Since SnipMate can't determine which template filter you are
|
||||
# expanding without the "|" character, these do not add the "|"
|
||||
# character. These save a few keystrokes still.
|
||||
class Meta:
|
||||
verbose_name = "$1"
|
||||
verbose_name_plural = "$1s"
|
||||
|
||||
# Note: Template tags that take no arguments are not implemented.
|
||||
def __str__(self):
|
||||
return super($1, self).__str__()
|
||||
|
||||
def save(self):
|
||||
return super($1, self).save()
|
||||
|
||||
@models.permalink
|
||||
def get_absolute_url(self):
|
||||
return ('')
|
||||
|
||||
${3:# TODO: Define custom methods here}
|
||||
|
||||
snippet add
|
||||
add:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet center
|
||||
center:"${1}"
|
||||
snippet mauto "AutoField" b
|
||||
${1:FIELDNAME} = models.AutoField($2)
|
||||
endsnippet
|
||||
|
||||
snippet cut
|
||||
cut:"${1}"
|
||||
snippet mbigint "BigIntegerField" b
|
||||
${1:FIELDNAME} = models.BigIntegerField($2)
|
||||
endsnippet
|
||||
|
||||
snippet date
|
||||
date:"${1}"
|
||||
snippet mbool "BooleanField" b
|
||||
${1:FIELDNAME} = models.BooleanField($2)
|
||||
endsnippet
|
||||
|
||||
snippet default
|
||||
default:"${1}"
|
||||
snippet mchar "CharField" b
|
||||
${1:FIELDNAME} = models.CharField($2, max_length=${3:50})
|
||||
endsnippet
|
||||
|
||||
snippet defaultifnone
|
||||
default_if_none:"${1}"
|
||||
snippet mcoseint "CommaSeparatedIntegerField" b
|
||||
${1:FIELDNAME} = models.CommaSeparatedIntegerField($2)
|
||||
endsnippet
|
||||
|
||||
snippet dictsort
|
||||
dictsort:"${1}"
|
||||
snippet mdate "DateField" b
|
||||
${1:FIELDNAME} = models.DateField($2)
|
||||
endsnippet
|
||||
|
||||
snippet dictsortrev
|
||||
dictsortreversed:"${1}"
|
||||
snippet mdatetime "DateTimeField" b
|
||||
${1:FIELDNAME} = models.DateTimeField($2)
|
||||
endsnippet
|
||||
|
||||
snippet divisibleby
|
||||
divisibleby:"${1}"
|
||||
snippet mdecimal "DecimalField" b
|
||||
${1:FIELDNAME} = models.DateTimeField($2)
|
||||
endsnippet
|
||||
|
||||
snippet floatformat
|
||||
floatformat:"${1}"
|
||||
snippet memail "EmailField" b
|
||||
${1:FIELDNAME} = models.EmailField($2)
|
||||
endsnippet
|
||||
|
||||
snippet getdigit
|
||||
get_digit:"${1}"
|
||||
snippet mfile "FileField" b
|
||||
${1:FIELDNAME} = models.FileField($2)
|
||||
endsnippet
|
||||
|
||||
snippet join
|
||||
join:"${1}"
|
||||
snippet mfilepath "FilePathField" b
|
||||
${1:FIELDNAME} = models.FilePathField($2)
|
||||
endsnippet
|
||||
|
||||
snippet lengthis
|
||||
length_is:"${1}"
|
||||
snippet mfloat "FloatField" b
|
||||
${1:FIELDNAME} = models.FloatField($2)
|
||||
endsnippet
|
||||
|
||||
snippet pluralize
|
||||
pluralize:"${1}"
|
||||
snippet fk "ForeignKey" b
|
||||
${1:FIELDNAME} = models.ForeignKey($2)
|
||||
endsnippet
|
||||
|
||||
snippet removetags
|
||||
removetags:"${1}"
|
||||
snippet mip "IPAddressField" b
|
||||
${1:FIELDNAME} = models.IPAddressField($2)
|
||||
endsnippet
|
||||
|
||||
snippet slice
|
||||
slice:"${1}"
|
||||
snippet mimg "ImageField" b
|
||||
${1:FIELDNAME} = models.ImageField($2)
|
||||
endsnippet
|
||||
|
||||
snippet stringformat
|
||||
stringformat:"${1}"
|
||||
snippet mint "IntegerField" b
|
||||
${1:FIELDNAME} = models.IntegerField($2)
|
||||
endsnippet
|
||||
|
||||
snippet time
|
||||
time:"${1}"
|
||||
snippet m2m "ManyToManyField" b
|
||||
${1:FIELDNAME} = models.ManyToManyField($2)
|
||||
endsnippet
|
||||
|
||||
snippet truncatewords
|
||||
truncatewords:${1}
|
||||
snippet mnullbool "NullBooleanField" b
|
||||
${1:FIELDNAME} = models.NullBooleanField($2)
|
||||
endsnippet
|
||||
|
||||
snippet truncatewordshtml
|
||||
truncatewords_html:${1}
|
||||
snippet o2o "OneToOneField" b
|
||||
${1:FIELDNAME} = models.OneToOneField($2)
|
||||
endsnippet
|
||||
|
||||
snippet urlizetrunc
|
||||
urlizetrunc:${1}
|
||||
snippet mphone "PhoneNumberField" b
|
||||
${1:FIELDNAME} = models.PhoneNumberField($2)
|
||||
endsnippet
|
||||
|
||||
snippet wordwrap
|
||||
wordwrap:${1}
|
||||
snippet mposint "PositiveIntegerField" b
|
||||
${1:FIELDNAME} = models.PositiveIntegerField($2)
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
snippet mpossmallint "PositiveSmallIntegerField" b
|
||||
${1:FIELDNAME} = models.PositiveSmallIntegerField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mslug "SlugField" b
|
||||
${1:FIELDNAME} = models.SlugField($2)
|
||||
endsnippet
|
||||
|
||||
snippet msmallint "SmallIntegerField" b
|
||||
${1:FIELDNAME} = models.SmallIntegerField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mtext "TextField" b
|
||||
${1:FIELDNAME} = models.TextField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mtime "TimeField" b
|
||||
${1:FIELDNAME} = models.TimeField($2)
|
||||
endsnippet
|
||||
|
||||
snippet murl "URLField" b
|
||||
${1:FIELDNAME} = models.URLField($2)
|
||||
endsnippet
|
||||
|
||||
snippet musstate "USStateField" b
|
||||
${1:FIELDNAME} = models.USStateField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mxml "XMLField" b
|
||||
${1:FIELDNAME} = models.XMLField($2)
|
||||
endsnippet
|
||||
|
||||
# VIEWS SNIPPETS
|
||||
|
||||
snippet adminview "Model Admin View" b
|
||||
class ${1}Admin(admin.ModelAdmin):
|
||||
'''
|
||||
Admin View for ${1}
|
||||
'''
|
||||
list_display = ('${2}',)
|
||||
list_filter = ('${3}',)
|
||||
inlines = [
|
||||
${4}Inline,
|
||||
]
|
||||
raw_id_fields = ('${5}',)
|
||||
readonly_fields = ('${6}',)
|
||||
search_fields = ['${7}']
|
||||
admin.site.register(${1}, ${1}Admin)
|
||||
endsnippet
|
||||
|
||||
snippet createview "Generic Create View" b
|
||||
class ${1:MODEL_NAME}CreateView(CreateView):
|
||||
model = ${1:MODEL_NAME}
|
||||
template_name = "${2:TEMPLATE_NAME}"
|
||||
endsnippet
|
||||
|
||||
snippet deleteview "Generic Delete View" b
|
||||
class ${1:MODEL_NAME}DeleteView(DeleteView):
|
||||
model = ${1:MODEL_NAME}
|
||||
template_name = "${2:TEMPLATE_NAME}"
|
||||
endsnippet
|
||||
|
||||
snippet detailview "Generic Detail View" b
|
||||
class ${1:MODEL_NAME}DetailView(DetailView):
|
||||
model = ${1:MODEL_NAME}
|
||||
template_name = "${2:TEMPLATE_NAME}"
|
||||
endsnippet
|
||||
|
||||
snippet listview "Generic List View" b
|
||||
class ${1:MODEL_NAME}ListView(ListView):
|
||||
model = ${1:MODEL_NAME}
|
||||
template_name = "${2:TEMPLATE_NAME}"
|
||||
endsnippet
|
||||
|
||||
snippet stackedinline "Stacked Inline" b
|
||||
class ${1}Inline(admin.StackedInline):
|
||||
'''
|
||||
Stacked Inline View for ${1}
|
||||
'''
|
||||
model = ${2:${1}}
|
||||
min_num = ${3:3}
|
||||
max_num = ${4:20}
|
||||
extra = ${5:1}
|
||||
raw_id_fields = (${6},)
|
||||
endsnippet
|
||||
|
||||
snippet tabularinline "Tabular Inline" b
|
||||
class ${1}Inline(admin.TabularInline):
|
||||
'''
|
||||
Tabular Inline View for ${1}
|
||||
'''
|
||||
model = ${2:${1}}
|
||||
min_num = ${3:3}
|
||||
max_num = ${4:20}
|
||||
extra = ${5:1}
|
||||
raw_id_fields = (${6},)
|
||||
endsnippet
|
||||
|
||||
snippet templateview "Generic Template View" b
|
||||
class ${1:CLASS_NAME}(TemplateView):
|
||||
template_name = "${2:TEMPLATE_NAME}"
|
||||
endsnippet
|
||||
|
||||
snippet updateview "Generic Update View" b
|
||||
class ${1:MODEL_NAME}UpdateView(UpdateView):
|
||||
model = ${1:MODEL_NAME}
|
||||
template_name = "${2:TEMPLATE_NAME}"
|
||||
endsnippet
|
||||
|
||||
snippet dispatch "Dispatch View method" b
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super(${1:CLASS_NAME}, self).dispatch(request, *args, **kwargs)
|
||||
endsnippet
|
||||
|
||||
snippet context "get_context_data view method" b
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs['extra_context'] = ${1:'New Value'}
|
||||
return super(${2:CLASS_NAME}, self).get_context_data(**kwargs)
|
||||
endsnippet
|
||||
|
@ -27,11 +27,11 @@ def textmate_var(var, snip):
|
||||
endglobal
|
||||
|
||||
|
||||
snippet % "<% ${0} %>"
|
||||
snippet % "<% ${0} %>" i
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`${0}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet = "<%= ${0} %>"
|
||||
snippet = "<%= ${0} %>" i
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`${0}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
@ -43,59 +43,59 @@ snippet fi "<%= Fixtures.identify(:symbol) %>"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`Fixtures.identify(:${1:name})`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`$0
|
||||
endsnippet
|
||||
|
||||
snippet ft "form_tag"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_tag(${1::action => '${5:update}'}${6:, {:${8:class} => '${9:form}'\}}) do`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
snippet ft "form_tag" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_tag(${1::action => '${2:update}'}${3:, ${4:${5:class} => '${6:form}'\}}}) do`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
$0
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet ffs "form_for submit 2"
|
||||
snippet ffs "form_for submit 2" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`${1:f}.submit '${2:Submit}'${3:, :disable_with => '${4:$2ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f_fields_for (nff)"
|
||||
snippet f. "f_fields_for (nff)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`f.fields_for :${1:attribute} do |${2:f}|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)`
|
||||
$0
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f.checkbox"
|
||||
snippet f. "f.checkbox" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.check_box :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f.file_field"
|
||||
snippet f. "f.file_field" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.file_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f.hidden_field"
|
||||
snippet f. "f.hidden_field" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.hidden_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f.label"
|
||||
snippet f. "f.label" w
|
||||
`!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
|
||||
|
||||
snippet f. "f.password_field"
|
||||
snippet f. "f.password_field" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.password_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f.radio_button"
|
||||
snippet f. "f.radio_button" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.radio_button :${1:attribute}, :${2:tag_value}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f.submit"
|
||||
snippet f. "f.submit" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.submit "${1:Submit}"${2:, :disable_with => '${3:$1ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f.text_area"
|
||||
snippet f. "f.text_area" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.text_area :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f.text_field"
|
||||
snippet f. "f.text_field" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.text_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet ffe "form_for with errors"
|
||||
snippet ffe "form_for with errors" w
|
||||
`!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)`form_for @${2:$1} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
@ -103,17 +103,17 @@ snippet ffe "form_for with errors"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet ff "form_for"
|
||||
snippet ff "form_for" w
|
||||
`!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
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet ist "image_submit_tag"
|
||||
snippet ist "image_submit_tag" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_submit_tag("${1:agree.png}"${2:${3:, :id => "${4:${1/^(\w+)(\.\w*)?$/$1/}}"}${5:, :name => "${6:${1/^(\w+)(\.\w*)?$/$1/}}"}${7:, :class => "${8:${1/^(\w+)(\.\w*)?$/$1/}-button}"}${9:, :disabled => ${10:false}}})`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet it "image_tag"
|
||||
snippet it "image_tag" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_tag "$1${2:.png}"${3:${4:, :title => "${5:title}"}${6:, :class => "${7:class}"}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
@ -121,47 +121,51 @@ snippet layout "layout"
|
||||
layout "${1:template_name}"${2:${3:, :only => ${4:[:${5:action}, :${6:action}]}}${7:, :except => ${8:[:${9:action}, :${10:action}]}}}
|
||||
endsnippet
|
||||
|
||||
snippet jit "javascript_include_tag"
|
||||
snippet jit "javascript_include_tag" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`javascript_include_tag ${1::all}${2:, :cache => ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet lia "link_to (action)"
|
||||
snippet lt "link_to (name, dest)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", ${2:dest}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet lia "link_to (action)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :action => "${2:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet liai "link_to (action, id)"
|
||||
snippet liai "link_to (action, id)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :action => "${2:edit}", :id => ${3:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet lic "link_to (controller)"
|
||||
snippet lic "link_to (controller)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :controller => "${2:items}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet lica "link_to (controller, action)"
|
||||
snippet lica "link_to (controller, action)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :controller => "${2:items}", :action => "${3:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet licai "link_to (controller, action, id)"
|
||||
snippet licai "link_to (controller, action, id)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :controller => "${2:items}", :action => "${3:edit}", :id => ${4:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet linpp "link_to (nested path plural)"
|
||||
snippet linpp "link_to (nested path plural)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${10:parent}_${11:child}_path(${12:@}${13:${10}})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet linp "link_to (nested path)"
|
||||
snippet linp "link_to (nested path)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${12:parent}_${13:child}_path(${14:@}${15:${12}}, ${16:@}${17:${13}})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet lipp "link_to (path plural)"
|
||||
snippet lipp "link_to (path plural)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${4:model}s_path}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet lip "link_to (path)"
|
||||
snippet lip "link_to (path)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${12:model}_path(${13:@}${14:${12}})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet lim "link_to model"
|
||||
snippet lim "link_to model" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:model}.${2:name}, ${3:${4:$1}_path(${14:$1})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
@ -213,11 +217,11 @@ snippet rps "render (partial,status) (rps)"
|
||||
render :partial => "${1:item}", :status => ${2:500}
|
||||
endsnippet
|
||||
|
||||
snippet slt "stylesheet_link_tag"
|
||||
snippet slt "stylesheet_link_tag" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`stylesheet_link_tag ${1::all}${2:, :cache => ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet st "submit_tag"
|
||||
snippet st "submit_tag" w
|
||||
`!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
|
||||
|
||||
|
@ -1,68 +0,0 @@
|
||||
priority -50
|
||||
|
||||
snippet if "if ... then ... else ..."
|
||||
if ${1:condition}
|
||||
then ${2:expression}
|
||||
else ${3:expression}
|
||||
endsnippet
|
||||
|
||||
snippet case "case ... of ..."
|
||||
case ${1:expression} of
|
||||
${2:pattern} -> ${3:expression}
|
||||
${4:pattern} -> ${5:expression}
|
||||
endsnippet
|
||||
|
||||
snippet :: "Type signature"
|
||||
${1:name} :: ${2:Type} -> ${3:Type}
|
||||
endsnippet
|
||||
|
||||
snippet => "Type constraint"
|
||||
(${1:Class} ${2:a}) => $2
|
||||
endsnippet
|
||||
|
||||
snippet def "Function definition"
|
||||
${1:name} :: ${2:Type} -> ${3:Type}
|
||||
endsnippet
|
||||
|
||||
snippet def[] "Function definition for list patterns"
|
||||
${1:name} :: [${2:Type}] -> ${3:Type}
|
||||
$1 [] = ${4:undefined}
|
||||
$1 ${5:(x:xs)} = ${6:undefined}
|
||||
endsnippet
|
||||
|
||||
snippet = "Function clause"
|
||||
${1:name} ${2:pattern} = ${3:undefined}
|
||||
endsnippet
|
||||
|
||||
snippet 2= "Function clause"
|
||||
${1:name} ${2:pattern} = ${3:undefined}
|
||||
$1 ${4:pattern} = ${5:undefined}
|
||||
endsnippet
|
||||
|
||||
snippet 3= "Function clause"
|
||||
${1:name} ${2:pattern} = ${3:undefined}
|
||||
$1 ${4:pattern} = ${5:undefined}
|
||||
$1 ${6:pattern} = ${7:undefined}
|
||||
endsnippet
|
||||
|
||||
snippet | "Guard"
|
||||
| ${1:predicate} = ${2:undefined}
|
||||
endsnippet
|
||||
|
||||
snippet \ "Lambda expression"
|
||||
\\${1:pattern} -> ${2:expression}
|
||||
endsnippet
|
||||
|
||||
snippet [|] "List comprehension"
|
||||
[${3:foo }$1 | ${1:x} <- ${2:xs} ]
|
||||
endsnippet
|
||||
|
||||
snippet let "let ... in ..."
|
||||
let ${1:name} = ${2:expression}
|
||||
in ${3:expression}
|
||||
endsnippet
|
||||
|
||||
snippet wh "where x = expression"
|
||||
where
|
||||
${1:name} = ${2:expression}
|
||||
endsnippet
|
@ -1,3 +1,299 @@
|
||||
priority -50
|
||||
|
||||
extends html, django
|
||||
extends html
|
||||
|
||||
# Generic Tags
|
||||
snippet % "" bi
|
||||
{% ${1} %}${2}
|
||||
endsnippet
|
||||
|
||||
snippet %% "" bi
|
||||
{% ${1:tag_name} %}
|
||||
${2}
|
||||
{% end$1 %}
|
||||
endsnippet
|
||||
|
||||
snippet { "" bi
|
||||
{{ ${1} }}${2}
|
||||
endsnippet
|
||||
|
||||
# Template Tags
|
||||
|
||||
snippet autoescape "" bi
|
||||
{% autoescape ${1:off} %}
|
||||
${2}
|
||||
{% endautoescape %}
|
||||
endsnippet
|
||||
|
||||
snippet block "" bi
|
||||
{% block ${1} %}
|
||||
${2}
|
||||
{% endblock $1 %}
|
||||
endsnippet
|
||||
|
||||
snippet # "" bi
|
||||
{# ${1:comment} #}
|
||||
endsnippet
|
||||
|
||||
snippet comment "" bi
|
||||
{% comment %}
|
||||
${1}
|
||||
{% endcomment %}
|
||||
endsnippet
|
||||
|
||||
snippet cycle "" bi
|
||||
{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %}
|
||||
endsnippet
|
||||
|
||||
snippet debug "" bi
|
||||
{% debug %}
|
||||
endsnippet
|
||||
|
||||
snippet extends "" bi
|
||||
{% extends "${1:base.html}" %}
|
||||
endsnippet
|
||||
|
||||
snippet filter "" bi
|
||||
{% filter ${1} %}
|
||||
${2}
|
||||
{% endfilter %}
|
||||
endsnippet
|
||||
|
||||
snippet firstof "" bi
|
||||
{% firstof ${1} %}
|
||||
endsnippet
|
||||
|
||||
snippet for "" bi
|
||||
{% for ${1} in ${2} %}
|
||||
${3}
|
||||
{% endfor %}
|
||||
endsnippet
|
||||
|
||||
snippet empty "" bi
|
||||
{% empty %}
|
||||
${1}
|
||||
endsnippet
|
||||
|
||||
snippet if "" bi
|
||||
{% if ${1} %}
|
||||
${2}
|
||||
{% endif %}
|
||||
endsnippet
|
||||
|
||||
snippet iif "" bi
|
||||
{% if ${1} %}${2}{% endif %}
|
||||
endsnippet
|
||||
|
||||
snippet ielse "" bi
|
||||
{% else %}${1}
|
||||
endsnippet
|
||||
|
||||
snippet else "" bi
|
||||
{% else %}
|
||||
${1}
|
||||
endsnippet
|
||||
|
||||
snippet ielif "" bi
|
||||
{% elif %}${1}
|
||||
endsnippet
|
||||
|
||||
snippet elif "" bi
|
||||
{% elif %}
|
||||
${1}
|
||||
endsnippet
|
||||
|
||||
snippet ifchanged "" bi
|
||||
{% ifchanged %}${1}{% endifchanged %}
|
||||
endsnippet
|
||||
|
||||
snippet ifequal "" bi
|
||||
{% ifequal ${1} ${2} %}
|
||||
${3}
|
||||
{% endifequal %}
|
||||
endsnippet
|
||||
|
||||
snippet ifnotequal "" bi
|
||||
{% ifnotequal ${1} ${2} %}
|
||||
${3}
|
||||
{% endifnotequal %}
|
||||
endsnippet
|
||||
|
||||
snippet include "" bi
|
||||
{% include "${1}" %}
|
||||
endsnippet
|
||||
|
||||
snippet load "" bi
|
||||
{% load ${1} %}
|
||||
endsnippet
|
||||
|
||||
snippet now "" bi
|
||||
{% now "${1:jS F Y H:i}" %}
|
||||
endsnippet
|
||||
|
||||
snippet regroup "" bi
|
||||
{% regroup ${1} by ${2} as ${3} %}
|
||||
endsnippet
|
||||
|
||||
snippet spaceless "" bi
|
||||
{% spaceless %}${1}{% endspaceless %}
|
||||
endsnippet
|
||||
|
||||
snippet ssi "" bi
|
||||
{% ssi ${1} %}
|
||||
endsnippet
|
||||
|
||||
snippet trans "" bi
|
||||
{% trans "${1:string}" %}
|
||||
endsnippet
|
||||
|
||||
snippet url "" bi
|
||||
{% url ${1} as ${2} %}
|
||||
endsnippet
|
||||
|
||||
snippet widthratio "" bi
|
||||
{% widthratio ${1:this_value} ${2:max_value} ${3:100} %}
|
||||
endsnippet
|
||||
|
||||
snippet with "" bi
|
||||
{% with ${1} as ${2} %}
|
||||
${VISUAL}
|
||||
{% endwith %}
|
||||
endsnippet
|
||||
|
||||
snippet verbatim "" bi
|
||||
{% verbatim %}
|
||||
${VISUAL}
|
||||
{% endverbatim %}
|
||||
endsnippet
|
||||
|
||||
snippet super "" bi
|
||||
{{ block.super }}
|
||||
endsnippet
|
||||
|
||||
snippet staticu "" bi
|
||||
{{ STATIC_URL }}
|
||||
endsnippet
|
||||
|
||||
snippet static "" bi
|
||||
{% static "${VISUAL}" %}
|
||||
endsnippet
|
||||
|
||||
snippet mediau "" bi
|
||||
{{ MEDIA_URL }}
|
||||
endsnippet
|
||||
|
||||
snippet iblock "" bi
|
||||
{% block ${1:blockname} %}${VISUAL}{% endblock $1 %}
|
||||
endsnippet
|
||||
|
||||
snippet csfr "" bi
|
||||
{% csrf_token %}
|
||||
endsnippet
|
||||
|
||||
snippet blocktrans "" bi
|
||||
{% blocktrans %}
|
||||
${VISUAL}
|
||||
{% endblocktrans %}
|
||||
endsnippet
|
||||
|
||||
snippet lorem "" bi
|
||||
{% lorem ${1} %}
|
||||
endsnippet
|
||||
|
||||
# Template Filters
|
||||
|
||||
# Note: Since SnipMate can't determine which template filter you are
|
||||
# expanding without the "|" character, these do not add the "|"
|
||||
# character. These save a few keystrokes still.
|
||||
|
||||
# Note: Template tags that take no arguments are not implemented.
|
||||
|
||||
snippet add "" bi
|
||||
add:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet center "" bi
|
||||
center:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet cut "" bi
|
||||
cut:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet date "" bi
|
||||
date:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet default "" bi
|
||||
default:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet defaultifnone "" bi
|
||||
default_if_none:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet dictsort "" bi
|
||||
dictsort:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet dictsortrev "" bi
|
||||
dictsortreversed:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet divisibleby "" bi
|
||||
divisibleby:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet floatformat "" bi
|
||||
floatformat:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet getdigit "" bi
|
||||
get_digit:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet join "" bi
|
||||
join:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet lengthis "" bi
|
||||
length_is:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet pluralize "" bi
|
||||
pluralize:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet removetags "" bi
|
||||
removetags:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet slice "" bi
|
||||
slice:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet stringformat "" bi
|
||||
stringformat:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet time "" bi
|
||||
time:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet truncatewords "" bi
|
||||
truncatewords:${1}
|
||||
endsnippet
|
||||
|
||||
snippet truncatewordshtml "" bi
|
||||
truncatewords_html:${1}
|
||||
endsnippet
|
||||
|
||||
snippet urlizetrunc "" bi
|
||||
urlizetrunc:${1}
|
||||
endsnippet
|
||||
|
||||
snippet wordwrap "" bi
|
||||
wordwrap:${1}
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -28,10 +28,40 @@ afterEach(function() {
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet befa "before all (js)" b
|
||||
beforeAll(function() {
|
||||
$0
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet afta "after all (js)" b
|
||||
afterAll(function() {
|
||||
$0
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet any "any (js)" b
|
||||
jasmine.any($1)
|
||||
endsnippet
|
||||
|
||||
snippet anyt "anything (js)" b
|
||||
jasmine.anything()
|
||||
endsnippet
|
||||
|
||||
snippet objc "object containing (js)" b
|
||||
jasmine.objectContaining({
|
||||
${VISUAL}$0
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet arrc "array containing (js)" b
|
||||
jasmine.arrayContaining([${1:value1}]);
|
||||
endsnippet
|
||||
|
||||
snippet strm "string matching (js)" b
|
||||
jasmine.stringMatching("${1:matcher}")
|
||||
endsnippet
|
||||
|
||||
snippet ru "runs (js)" b
|
||||
runs(function() {
|
||||
$0
|
||||
@ -50,6 +80,14 @@ snippet ee "expect to equal (js)" b
|
||||
expect(${1:target}).toEqual(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet el "expect to be less than (js)" b
|
||||
expect(${1:target}).toBeLessThan(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet eg "expect to be greater than (js)" b
|
||||
expect(${1:target}).toBeGreaterThan(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet eb "expect to be (js)" b
|
||||
expect(${1:target}).toBe(${2:value});
|
||||
endsnippet
|
||||
@ -74,6 +112,10 @@ snippet ed "expect to be defined (js)" b
|
||||
expect(${1:target}).toBeDefined();
|
||||
endsnippet
|
||||
|
||||
snippet eud "expect to be defined (js)" b
|
||||
expect(${1:target}).toBeUndefined();
|
||||
endsnippet
|
||||
|
||||
snippet en "expect to be null (js)" b
|
||||
expect(${1:target}).toBeNull();
|
||||
endsnippet
|
||||
@ -98,6 +140,14 @@ snippet note "expect not to equal (js)" b
|
||||
expect(${1:target}).not.toEqual(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notl "expect to not be less than (js)" b
|
||||
expect(${1:target}).not.toBeLessThan(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notg "expect to not be greater than (js)" b
|
||||
expect(${1:target})..not.toBeGreaterThan(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notm "expect not to match (js)" b
|
||||
expect(${1:target}).not.toMatch(${2:pattern});
|
||||
endsnippet
|
||||
@ -139,35 +189,19 @@ spyOn(${1:object}, '${2:method}')$0;
|
||||
endsnippet
|
||||
|
||||
snippet sr "spy on and return (js)" b
|
||||
spyOn(${1:object}, '${2:method}').andReturn(${3:arguments});
|
||||
spyOn(${1:object}, '${2:method}').and.returnValue(${3:arguments});
|
||||
endsnippet
|
||||
|
||||
snippet st "spy on and throw (js)" b
|
||||
spyOn(${1:object}, '${2:method}').andThrow(${3:exception});
|
||||
spyOn(${1:object}, '${2:method}').and.throwError(${3:exception});
|
||||
endsnippet
|
||||
|
||||
snippet sct "spy on and call through (js)" b
|
||||
spyOn(${1:object}, '${2:method}').andCallThrough();
|
||||
spyOn(${1:object}, '${2:method}').and.callThrough();
|
||||
endsnippet
|
||||
|
||||
snippet scf "spy on and call fake (js)" b
|
||||
spyOn(${1:object}, '${2:method}').andCallFake(${3:function});
|
||||
endsnippet
|
||||
|
||||
snippet esc "expect was called (js)" b
|
||||
expect(${1:target}).wasCalled();
|
||||
endsnippet
|
||||
|
||||
snippet escw "expect was called with (js)" b
|
||||
expect(${1:target}).wasCalledWith(${2:arguments});
|
||||
endsnippet
|
||||
|
||||
snippet notsc "expect was not called (js)" b
|
||||
expect(${1:target}).wasNotCalled();
|
||||
endsnippet
|
||||
|
||||
snippet noscw "expect was not called with (js)" b
|
||||
expect(${1:target}).wasNotCalledWith(${2:arguments});
|
||||
spyOn(${1:object}, '${2:method}').and.callFake(${3:function});
|
||||
endsnippet
|
||||
|
||||
snippet ethbc "expect to have been called (js)" b
|
@ -0,0 +1,65 @@
|
||||
priority -50
|
||||
|
||||
snippet #! "shebang"
|
||||
#!/usr/bin/env node
|
||||
endsnippet
|
||||
|
||||
snippet vreq "assign a CommonJS-style module to a var"
|
||||
var ${0:${1/(.+\/)*(\w+)(-|\b|$)(\..+$)?/\u$2/g}} = require('${1}');
|
||||
endsnippet
|
||||
|
||||
snippet ex "module.exports"
|
||||
module.exports = ${1};
|
||||
endsnippet
|
||||
|
||||
snippet hcs "http.createServer"
|
||||
http.createServer(${1}).listen(${2});
|
||||
endsnippet
|
||||
|
||||
snippet ncs "net.createServer"
|
||||
net.createServer(function(${1:socket}){
|
||||
${1}.on('data', function(${3:data}){
|
||||
${4}
|
||||
});
|
||||
${1}.on('end', function(){
|
||||
${5}
|
||||
});
|
||||
}).listen(${6:8124});
|
||||
endsnippet
|
||||
|
||||
snippet pipe "pipe"
|
||||
pipe(${1:stream})${2}
|
||||
endsnippet
|
||||
|
||||
# Express snippets
|
||||
|
||||
snippet eget "express GET"
|
||||
${1:app}.get('${2}', ${3});
|
||||
endsnippet
|
||||
|
||||
snippet epost "express POST"
|
||||
${1:app}.post('${2}', ${3});
|
||||
endsnippet
|
||||
|
||||
snippet eput "express PUT"
|
||||
${1:app}.put('${2}', ${3});
|
||||
endsnippet
|
||||
|
||||
snippet edelete "express DELETE"
|
||||
${1:app}.delete('${2}', ${3});
|
||||
endsnippet
|
||||
|
||||
# process snippets
|
||||
|
||||
snippet stdout "stdout"
|
||||
process.stdout
|
||||
endsnippet
|
||||
|
||||
snippet stdin "stdin"
|
||||
process.stdin
|
||||
endsnippet
|
||||
|
||||
snippet stderr "stderr"
|
||||
process.stderr
|
||||
endsnippet
|
||||
|
@ -0,0 +1,205 @@
|
||||
snippet sapmlabel
|
||||
var ${1} = new sap.m.Label({
|
||||
design : ${2},
|
||||
text : ${3},
|
||||
visible : ${4},
|
||||
textAlign : ${5},
|
||||
textDirection : ${6},
|
||||
width : ${7},
|
||||
required : ${7}
|
||||
});
|
||||
|
||||
snippet sapmtext
|
||||
var ${1} = new sap.m.Text({
|
||||
text :${2},
|
||||
textDirection :${3},
|
||||
visible :${4},
|
||||
wrapping : ${5},
|
||||
textAlign : ${6},
|
||||
width :${7},
|
||||
maxLines :${8}
|
||||
});
|
||||
|
||||
snippet sapmbutton
|
||||
var ${1} = new sap.m.Button({
|
||||
text : ${2},
|
||||
type : ${3},
|
||||
width : ${4},
|
||||
enabled :${5},
|
||||
visible :${6},
|
||||
icon : ${7},
|
||||
iconFirst : ${8},
|
||||
activeIcon :${9},
|
||||
iconDensityAware : ${10},
|
||||
});
|
||||
snippet sapmflexbox
|
||||
var ${1} = new sap.m.FlexBox({
|
||||
visible : ${2},
|
||||
height : ${3},
|
||||
width : ${4},
|
||||
displayInline :${5},
|
||||
direction :${6},
|
||||
fitContainer : ${7},
|
||||
renderType : ${8},
|
||||
justifyContent :${9},
|
||||
alignItems : ${10},
|
||||
items:[]
|
||||
});
|
||||
snippet sapmhbox
|
||||
var ${1} = new sap.m.HBox({
|
||||
visible : ${2},
|
||||
height : ${3},
|
||||
width : ${4},
|
||||
displayInline :${5},
|
||||
direction :${6},
|
||||
fitContainer : ${7},
|
||||
renderType : ${8},
|
||||
justifyContent :${9},
|
||||
alignItems : ${10},
|
||||
items:[]
|
||||
});
|
||||
|
||||
snippet sapmvbox
|
||||
var ${1} = new sap.m.VBox({
|
||||
visible : ${2},
|
||||
height : ${3},
|
||||
width : ${4},
|
||||
displayInline :${5},
|
||||
direction :${6},
|
||||
fitContainer : ${7},
|
||||
renderType : ${8},
|
||||
justifyContent :${9},
|
||||
alignItems : ${10},
|
||||
items:[]
|
||||
});
|
||||
|
||||
snippet sapcomponent
|
||||
sap.ui.controller("${1}", {
|
||||
onInit: function(){
|
||||
},
|
||||
onAfterRendering: function() {
|
||||
},
|
||||
onAfterRendering: function() {
|
||||
},
|
||||
onExit: function() {
|
||||
},
|
||||
});
|
||||
|
||||
snippet sapminput
|
||||
var ${1} = new sap.m.Input({
|
||||
value :${2},
|
||||
width : ${3},
|
||||
enabled :${4},
|
||||
visible :${5},
|
||||
valueState :${6},
|
||||
name : ${7},
|
||||
placeholder : ${8},
|
||||
editable : ${9},
|
||||
type : ${10},
|
||||
maxLength :${11},
|
||||
valueStateText :${12},
|
||||
showValueStateMessage :${13},
|
||||
dateFormat :${14},
|
||||
showValueHelp :${15},
|
||||
showSuggestion :${16},
|
||||
valueHelpOnly :${17},
|
||||
filterSuggests :${18},
|
||||
maxSuggestionWidth :${19},
|
||||
startSuggestion : ${20},
|
||||
showTableSuggestionValueHelp : ${21},
|
||||
description : ${22},
|
||||
fieldWidth : ${23},
|
||||
valueLiveUpdate :${24},
|
||||
suggestionItems :[${25}],
|
||||
suggestionColumns : [${26}],
|
||||
suggestionRows : [${27}],
|
||||
liveChange : ${28},
|
||||
valueHelpRequest :${29},
|
||||
suggest : ${30},
|
||||
suggestionItemSelected : ${31}
|
||||
});
|
||||
snippet _sthis
|
||||
var _self = this;
|
||||
|
||||
snippet sapmresponsivepopup
|
||||
var ${1} = new sap.m.ResponsivePopover({
|
||||
placement :${2} ,//sap.m.PlacementType (default: sap.m.PlacementType.Right)
|
||||
showHeader :${3} ,//boolean (default: true)
|
||||
title : ${4},//string
|
||||
icon :${5} ,//sap.ui.core.URI
|
||||
modal :${6} ,// boolean
|
||||
offsetX :${7}, //int
|
||||
offsetY :${8}, //int
|
||||
contentWidth : ${9},//sap.ui.core.CSSSize
|
||||
contentHeight :${10}, //sap.ui.core.CSSSize
|
||||
horizontalScrolling :${11}, //boolean
|
||||
verticalScrolling :${12}, //boolean
|
||||
showCloseButton :${13}, //boolean (default: true)
|
||||
//Aggregations
|
||||
content :${14}, //sap.ui.core.Control[]
|
||||
customHeader :${15}, //sap.m.IBar
|
||||
subHeader : ${16}, //sap.m.IBar
|
||||
beginButton :${17}, //sap.m.Button
|
||||
endButton : ${18}, //sap.m.Button
|
||||
//Associations
|
||||
initialFocus : ${19}, //string | sap.ui.core.Control
|
||||
//Events
|
||||
beforeOpen :${20}, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
|
||||
afterOpen : ${21}, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
|
||||
beforeClose : ${22}, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
|
||||
afterClose : ${23} //fnList
|
||||
});
|
||||
|
||||
snippet sapicon
|
||||
var ${1} = new sap.ui.core.Icon({
|
||||
src :${2} , //sap.ui.core.URI
|
||||
size :${3} , //sap.ui.core.CSSSize
|
||||
color :${4} , //sap.ui.core.CSSColor
|
||||
hoverColor : ${5} , // sap.ui.core.CSSColor
|
||||
activeColor :${6} , //sap.ui.core.CSSColor
|
||||
width :${7} , //sap.ui.core.CSSSize
|
||||
height : ${8} ,//sap.ui.core.CSSSize
|
||||
backgroundColor :${8} , //sap.ui.core.CSSColor
|
||||
hoverBackgroundColor :${9} , //sap.ui.core.CSSColor
|
||||
activeBackgroundColor :${10} , //sap.ui.core.CSSColor
|
||||
visible :${11} , //boolean (default: true)
|
||||
decorative : ${12} ,//boolean (default: true)
|
||||
});
|
||||
snippet extendVerticalL
|
||||
sap.ui.layout.VerticalLayout.extend("${1}", {
|
||||
metadata: {
|
||||
properties: {
|
||||
${2}
|
||||
},
|
||||
aggregations: {
|
||||
${3}
|
||||
},
|
||||
events: {
|
||||
${4}
|
||||
}
|
||||
},
|
||||
init: function(){
|
||||
${5}
|
||||
},
|
||||
|
||||
renderer: "${6}"
|
||||
});
|
||||
snippet extendHorizontalL
|
||||
sap.ui.layout.HorizontalLayout.extend("${1}", {
|
||||
metadata: {
|
||||
properties: {
|
||||
${2}
|
||||
},
|
||||
aggregations: {
|
||||
${3}
|
||||
},
|
||||
events: {
|
||||
${4}
|
||||
}
|
||||
},
|
||||
init: function(){
|
||||
${5}
|
||||
},
|
||||
|
||||
renderer: "${6}"
|
||||
});
|
@ -59,7 +59,7 @@ ${1:var }${2:function_name} = function $2(${3}) {
|
||||
endsnippet
|
||||
|
||||
snippet iife "Immediately-Invoked Function Expression (iife)"
|
||||
(function (${1:argument}) {
|
||||
(function(${1:window}) {
|
||||
${VISUAL}$0
|
||||
}(${2:$1}));
|
||||
endsnippet
|
||||
|
@ -32,6 +32,65 @@ for ${1:i}=${2:first},${3:last}${4/^..*/(?0:,:)/}${4:step} do
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet do "do block"
|
||||
do
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet repeat "repeat loop" b
|
||||
repeat
|
||||
$1
|
||||
until $0
|
||||
endsnippet
|
||||
|
||||
snippet while "while loop" b
|
||||
while $1 do
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet if "if statement" b
|
||||
if $1 then
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet ife "if/else statement" b
|
||||
if $1 then
|
||||
$2
|
||||
else
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet eif "if/elseif statement" b
|
||||
if $1 then
|
||||
$2
|
||||
elseif $3 then
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet eife "if/elseif/else statement" b
|
||||
if $1 then
|
||||
$2
|
||||
elseif $3 then
|
||||
$4
|
||||
else
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet pcall "pcall statement" b
|
||||
local ok, err = pcall(${1:your_function})
|
||||
if not ok then
|
||||
handler(${2:ok, err})
|
||||
${3:else
|
||||
success(${4:ok, err})
|
||||
}end
|
||||
endsnippet
|
||||
|
||||
snippet local "local x = 1"
|
||||
local ${1:x} = ${0:1}
|
||||
endsnippet
|
||||
|
@ -4,7 +4,7 @@ extends markdown
|
||||
priority -49
|
||||
|
||||
snippet title "Title Header" b
|
||||
% ${1:`!v Filename('', 'title')`}
|
||||
% ${1:`!v vim_snippets#Filename('$1', 'title')`}
|
||||
% ${2:`!v g:snips_author`}
|
||||
% ${3:`!v strftime("%d %B %Y")`}
|
||||
|
||||
|
@ -12,10 +12,16 @@ $0
|
||||
endsnippet
|
||||
|
||||
snippet ifmain "ifmain" b
|
||||
if __name__ == '__main__':
|
||||
if __name__ == `!p snip.rv = get_quoting_style(snip)`__main__`!p snip.rv = get_quoting_style(snip)`:
|
||||
${1:${VISUAL:main()}}
|
||||
endsnippet
|
||||
|
||||
snippet with "with" b
|
||||
with ${1:expr}`!p snip.rv = " as " if t[2] else ""`${2:var}:
|
||||
${3:${VISUAL:pass}}
|
||||
${0}
|
||||
endsnippet
|
||||
|
||||
snippet for "for loop" b
|
||||
for ${1:item} in ${2:iterable}:
|
||||
${3:${VISUAL:pass}}
|
||||
@ -35,6 +41,8 @@ NORMAL = 0x1
|
||||
DOXYGEN = 0x2
|
||||
SPHINX = 0x3
|
||||
GOOGLE = 0x4
|
||||
NUMPY = 0x5
|
||||
JEDI = 0x6
|
||||
|
||||
SINGLE_QUOTES = "'"
|
||||
DOUBLE_QUOTES = '"'
|
||||
@ -69,7 +77,10 @@ def get_quoting_style(snip):
|
||||
return DOUBLE_QUOTES
|
||||
|
||||
def triple_quotes(snip):
|
||||
return get_quoting_style(snip) * 3
|
||||
style = snip.opt("g:ultisnips_python_triple_quoting_style")
|
||||
if not style:
|
||||
return get_quoting_style(snip) * 3
|
||||
return (SINGLE_QUOTES if style == 'single' else DOUBLE_QUOTES) * 3
|
||||
|
||||
def triple_quotes_handle_trailing(snip, quoting_style):
|
||||
"""
|
||||
@ -105,6 +116,8 @@ def get_style(snip):
|
||||
if style == "doxygen": return DOXYGEN
|
||||
elif style == "sphinx": return SPHINX
|
||||
elif style == "google": return GOOGLE
|
||||
elif style == "numpy": return NUMPY
|
||||
elif style == "jedi": return JEDI
|
||||
else: return NORMAL
|
||||
|
||||
|
||||
@ -117,12 +130,16 @@ def format_arg(arg, style):
|
||||
return ":%s: TODO" % arg
|
||||
elif style == GOOGLE:
|
||||
return "%s (TODO): TODO" % arg
|
||||
elif style == JEDI:
|
||||
return ":type %s: TODO" % arg
|
||||
elif style == NUMPY:
|
||||
return "%s : TODO" % arg
|
||||
|
||||
|
||||
def format_return(style):
|
||||
if style == DOXYGEN:
|
||||
return "@return: TODO"
|
||||
elif style in (NORMAL, SPHINX):
|
||||
elif style in (NORMAL, SPHINX, JEDI):
|
||||
return ":returns: TODO"
|
||||
elif style == GOOGLE:
|
||||
return "Returns: TODO"
|
||||
@ -139,6 +156,8 @@ def write_docstring_args(args, snip):
|
||||
|
||||
if style == GOOGLE:
|
||||
write_google_docstring_args(args, snip)
|
||||
elif style == NUMPY:
|
||||
write_numpy_docstring_args(args, snip)
|
||||
else:
|
||||
for arg in args:
|
||||
snip += format_arg(arg, style)
|
||||
@ -165,6 +184,23 @@ def write_google_docstring_args(args, snip):
|
||||
snip.rv += '\n' + snip.mkline('', indent='')
|
||||
|
||||
|
||||
def write_numpy_docstring_args(args, snip):
|
||||
if args:
|
||||
snip += "Parameters"
|
||||
snip += "----------"
|
||||
|
||||
kwargs = [arg for arg in args if arg.is_kwarg()]
|
||||
args = [arg for arg in args if not arg.is_kwarg()]
|
||||
|
||||
if args:
|
||||
for arg in args:
|
||||
snip += format_arg(arg, NUMPY)
|
||||
if kwargs:
|
||||
for kwarg in kwargs:
|
||||
snip += format_arg(kwarg, NUMPY) + ', optional'
|
||||
snip.rv += '\n' + snip.mkline('', indent='')
|
||||
|
||||
|
||||
def write_init_body(args, parents, snip):
|
||||
parents = [p.strip() for p in parents.split(",")]
|
||||
parents = [p for p in parents if p != 'object']
|
||||
@ -199,7 +235,13 @@ def write_function_docstring(t, snip):
|
||||
write_docstring_args(args, snip)
|
||||
|
||||
style = get_style(snip)
|
||||
snip += format_return(style)
|
||||
|
||||
if style == NUMPY:
|
||||
snip += 'Returns'
|
||||
snip += '-------'
|
||||
snip += 'TODO'
|
||||
else:
|
||||
snip += format_return(style)
|
||||
snip.rv += '\n' + snip.mkline('', indent='')
|
||||
snip += triple_quotes(snip)
|
||||
|
||||
@ -546,14 +588,14 @@ endsnippet
|
||||
snippet try "Try / Except" b
|
||||
try:
|
||||
${1:${VISUAL:pass}}
|
||||
except ${2:Exception}, ${3:e}:
|
||||
except ${2:Exception} as ${3:e}:
|
||||
${4:raise $3}
|
||||
endsnippet
|
||||
|
||||
snippet trye "Try / Except / Else" b
|
||||
try:
|
||||
${1:${VISUAL:pass}}
|
||||
except ${2:Exception}, ${3:e}:
|
||||
except ${2:Exception} as ${3:e}:
|
||||
${4:raise $3}
|
||||
else:
|
||||
${5:pass}
|
||||
@ -562,7 +604,7 @@ endsnippet
|
||||
snippet tryf "Try / Except / Finally" b
|
||||
try:
|
||||
${1:${VISUAL:pass}}
|
||||
except ${2:Exception}, ${3:e}:
|
||||
except ${2:Exception} as ${3:e}:
|
||||
${4:raise $3}
|
||||
finally:
|
||||
${5:pass}
|
||||
@ -571,7 +613,7 @@ endsnippet
|
||||
snippet tryef "Try / Except / Else / Finally" b
|
||||
try:
|
||||
${1:${VISUAL:pass}}
|
||||
except${2: ${3:Exception}, ${4:e}}:
|
||||
except${2: ${3:Exception} as ${4:e}}:
|
||||
${5:raise}
|
||||
else:
|
||||
${6:pass}
|
||||
@ -588,6 +630,10 @@ snippet pdb "Set PDB breakpoint" b
|
||||
import pdb; pdb.set_trace()
|
||||
endsnippet
|
||||
|
||||
snippet ipy "Embed IPython shell" b
|
||||
import IPython; IPython.embed()
|
||||
endsnippet
|
||||
|
||||
snippet ipdb "Set IPDB breakpoint" b
|
||||
import ipdb; ipdb.set_trace()
|
||||
endsnippet
|
||||
|
@ -18,6 +18,12 @@ fn ${1:function_name}(${2})${3/..*/ -> /}${3} {
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet pfn "A public function, optionally with arguments and return type."
|
||||
pub fn ${1:function_name}(${2})${3/..*/ -> /}${3} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet arg "Function Arguments" i
|
||||
${1:a}: ${2:T}${3:, arg}
|
||||
endsnippet
|
||||
|
@ -1,57 +0,0 @@
|
||||
extends css
|
||||
|
||||
priority -50
|
||||
|
||||
snippet imp "@import '...';" b
|
||||
@import '${1:file}';
|
||||
endsnippet
|
||||
|
||||
snippet inc "@include mixin(...);" b
|
||||
@include ${1:mixin}(${2});
|
||||
endsnippet
|
||||
|
||||
snippet ext "@extend %placeholder;" b
|
||||
@extend %${1:%placeholder};
|
||||
endsnippet
|
||||
|
||||
snippet mixin "@mixin (...) { ... }" b
|
||||
@mixin ${1:name}(${2}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fun "@function (...) { ... }" b
|
||||
@function ${1:name}(${2}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet if "@if (...) { ... }" b
|
||||
@if ${1:condition} {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet else "@else { ... }" b
|
||||
@else ${1:condition} {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "@for loop" b
|
||||
@for ${1:$i} from ${2:1} through ${3:3} {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet each "@each loop" b
|
||||
@each ${1:$item} in ${2:item, item, item} {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet while "@while loop" b
|
||||
@while ${1:$i} ${2:>} ${3:0} {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
@ -0,0 +1,10 @@
|
||||
snippet for
|
||||
for (${1:1}, ${2:10}) {${3: |i}|}
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
snippet sdef
|
||||
SynthDef(\\${1:synthName}, {${2: |${3:x}|}
|
||||
${0}
|
||||
}).add;
|
||||
endsnippet
|
@ -0,0 +1,3 @@
|
||||
priority -50
|
||||
|
||||
extends javascript
|
@ -1,5 +1,7 @@
|
||||
"""Helper methods used in UltiSnips snippets."""
|
||||
|
||||
import string, vim
|
||||
|
||||
def complete(tab, opts):
|
||||
"""
|
||||
get options that start with tab
|
||||
@ -18,3 +20,73 @@ def complete(tab, opts):
|
||||
if not len(opts):
|
||||
msg = "{0}"
|
||||
return msg.format("|".join(opts))
|
||||
|
||||
def _parse_comments(s):
|
||||
""" Parses vim's comments option to extract comment format """
|
||||
i = iter(s.split(","))
|
||||
|
||||
rv = []
|
||||
try:
|
||||
while True:
|
||||
# get the flags and text of a comment part
|
||||
flags, text = next(i).split(':', 1)
|
||||
|
||||
if len(flags) == 0:
|
||||
rv.append((text, text, text, ""))
|
||||
# parse 3-part comment, but ignore those with O flag
|
||||
elif 's' in flags and 'O' not in flags:
|
||||
ctriple = ["TRIPLE"]
|
||||
indent = ""
|
||||
|
||||
if flags[-1] in string.digits:
|
||||
indent = " " * int(flags[-1])
|
||||
ctriple.append(text)
|
||||
|
||||
flags, text = next(i).split(':', 1)
|
||||
assert flags[0] == 'm'
|
||||
ctriple.append(text)
|
||||
|
||||
flags, text = next(i).split(':', 1)
|
||||
assert flags[0] == 'e'
|
||||
ctriple.append(text)
|
||||
ctriple.append(indent)
|
||||
|
||||
rv.append(ctriple)
|
||||
elif 'b' in flags:
|
||||
if len(text) == 1:
|
||||
rv.insert(0, ("SINGLE_CHAR", text, text, text, ""))
|
||||
except StopIteration:
|
||||
return rv
|
||||
|
||||
def get_comment_format():
|
||||
""" Returns a 4-element tuple (first_line, middle_lines, end_line, indent)
|
||||
representing the comment format for the current file.
|
||||
|
||||
It first looks at the 'commentstring', if that ends with %s, it uses that.
|
||||
Otherwise it parses '&comments' and prefers single character comment
|
||||
markers if there are any.
|
||||
"""
|
||||
commentstring = vim.eval("&commentstring")
|
||||
if commentstring.endswith("%s"):
|
||||
c = commentstring[:-2]
|
||||
return (c, c, c, "")
|
||||
comments = _parse_comments(vim.eval("&comments"))
|
||||
for c in comments:
|
||||
if c[0] == "SINGLE_CHAR":
|
||||
return c[1:]
|
||||
return comments[0][1:]
|
||||
|
||||
|
||||
def make_box(twidth, bwidth=None):
|
||||
b, m, e, i = get_comment_format()
|
||||
bwidth_inner = bwidth - 3 - max(len(b), len(i + e)) if bwidth else twidth + 2
|
||||
sline = b + m + bwidth_inner * m[0] + 2 * m[0]
|
||||
nspaces = (bwidth_inner - twidth) // 2
|
||||
mlines = i + m + " " + " " * nspaces
|
||||
mlinee = " " + " "*(bwidth_inner - twidth - nspaces) + m
|
||||
eline = i + m + bwidth_inner * m[0] + 2 * m[0] + e
|
||||
return sline, mlines, mlinee, eline
|
||||
|
||||
def foldmarker():
|
||||
"Return a tuple of (open fold marker, close fold marker)"
|
||||
return vim.eval("&foldmarker").split(",")
|
||||
|
@ -25,7 +25,7 @@ snippet Inc
|
||||
snippet ndef
|
||||
#ifndef $1
|
||||
#define ${1:SYMBOL} ${2:value}
|
||||
#endif
|
||||
#endif /* ifndef $1 */
|
||||
# define
|
||||
snippet def
|
||||
#define
|
||||
@ -98,6 +98,8 @@ snippet case
|
||||
case ${1:/* variable case */}:
|
||||
${2}
|
||||
${3:break;}
|
||||
snippet ret
|
||||
return ${0};
|
||||
##
|
||||
## Loops
|
||||
# for
|
||||
@ -146,6 +148,9 @@ snippet tds
|
||||
typedef struct ${2:_$1 }{
|
||||
${3:/* data */}
|
||||
} ${1:`vim_snippets#Filename('$1_t', 'name')`};
|
||||
|
||||
snippet enum
|
||||
enum ${1:name} { ${0} };
|
||||
# typedef enum
|
||||
snippet tde
|
||||
typedef enum {
|
||||
@ -221,23 +226,3 @@ snippet getopt
|
||||
# This is kind of convenient
|
||||
snippet .
|
||||
[${1}]
|
||||
# GPL
|
||||
snippet gpl
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright (C) ${1:Author}, `strftime("%Y")`
|
||||
*/
|
||||
|
||||
${0}
|
||||
|
@ -1,5 +1,13 @@
|
||||
extends c
|
||||
|
||||
##
|
||||
## Preprocessor
|
||||
# #include <...>
|
||||
snippet inc
|
||||
#include <${1:iostream}>
|
||||
snippet binc
|
||||
#include <boost/${1:shared_ptr}.hpp>
|
||||
##
|
||||
## STL Collections
|
||||
# std::array
|
||||
snippet array
|
||||
|
@ -70,7 +70,7 @@ snippet defma
|
||||
${0}
|
||||
end
|
||||
snippet defmo
|
||||
defmodule ${1:module_name} do
|
||||
defmodule ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} do
|
||||
${0}
|
||||
end
|
||||
snippet defp
|
||||
@ -123,3 +123,7 @@ snippet try try .. rescue .. end
|
||||
snippet pry
|
||||
require IEx; IEx.pry
|
||||
${0}
|
||||
snippet qu
|
||||
quote do
|
||||
${1}
|
||||
end
|
||||
|
@ -22,23 +22,23 @@ snippet for
|
||||
${0}
|
||||
<% end %>
|
||||
snippet rp
|
||||
<%= render :partial => '${0:item}' %>
|
||||
<%= render partial: '${0:item}' %>
|
||||
snippet rpl
|
||||
<%= render :partial => '${1:item}', :locals => { :${2:name} => '${3:value}'${0} } %>
|
||||
<%= render partial: '${1:item}', locals: { :${2:name} => '${3:value}'${0} } %>
|
||||
snippet rps
|
||||
<%= render :partial => '${1:item}', :status => ${0:500} %>
|
||||
<%= render partial: '${1:item}', status: ${0:500} %>
|
||||
snippet rpc
|
||||
<%= render :partial => '${1:item}', :collection => ${0:items} %>
|
||||
<%= render partial: '${1:item}', collection: ${0:items} %>
|
||||
snippet lia
|
||||
<%= link_to '${1:link text...}', :action => '${0:index}' %>
|
||||
<%= link_to '${1:link text...}', action: '${0:index}' %>
|
||||
snippet liai
|
||||
<%= link_to '${1:link text...}', :action => '${2:edit}', :id => ${0:@item} %>
|
||||
<%= link_to '${1:link text...}', action: '${2:edit}', id: ${0:@item} %>
|
||||
snippet lic
|
||||
<%= link_to '${1:link text...}', :controller => '${0:items}' %>
|
||||
<%= link_to '${1:link text...}', controller: '${0:items}' %>
|
||||
snippet lica
|
||||
<%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${0:index}' %>
|
||||
<%= link_to '${1:link text...}', controller: '${2:items}', action: '${0:index}' %>
|
||||
snippet licai
|
||||
<%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:edit}', :id => ${0:@item} %>
|
||||
<%= link_to '${1:link text...}', controller: '${2:items}', action: '${3:edit}', id: ${0:@item} %>
|
||||
snippet yield
|
||||
<%= yield ${1::content_symbol} %>
|
||||
snippet conf
|
||||
@ -110,11 +110,11 @@ snippet ofcfs
|
||||
snippet ofs
|
||||
<%= options_for_select ${1:collection}, ${2:value_method} %>
|
||||
snippet rf
|
||||
<%= render :file => "${1:file}"${0} %>
|
||||
<%= render file: "${1:file}"${0} %>
|
||||
snippet rt
|
||||
<%= render :template => "${1:file}"${0} %>
|
||||
<%= render template: "${1:file}"${0} %>
|
||||
snippet slt
|
||||
<%= stylesheet_link_tag ${1::all}, :cache => ${0:true} %>
|
||||
<%= stylesheet_link_tag ${1::all}, cache: ${0:true} %>
|
||||
snippet sslt
|
||||
<%= stylesheet_link_tag "${0}" %>
|
||||
snippet if
|
||||
|
@ -2,11 +2,13 @@ snippet lang
|
||||
{-# LANGUAGE ${0:OverloadedStrings} #-}
|
||||
snippet haddock
|
||||
{-# OPTIONS_HADDOCK ${0:hide} #-}
|
||||
snippet ghc
|
||||
{-# OPTIONS_GHC ${0:-fno-warn-unused-imports} #-}
|
||||
snippet inline
|
||||
{-# INLINE ${0:name} #-}
|
||||
snippet info
|
||||
-- |
|
||||
-- Module : ${1:Module.Namespace}
|
||||
-- Module : ${1:`substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')`}
|
||||
-- Copyright : ${2:Author} ${3:2011-2012}
|
||||
-- License : ${4:BSD3}
|
||||
--
|
||||
@ -40,9 +42,12 @@ snippet class
|
||||
${0}
|
||||
snippet module
|
||||
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` (
|
||||
) where
|
||||
`expand('%') =~ 'Main' ? "\n\nmain = do\n print \"hello world\"" : ""`
|
||||
) where
|
||||
`expand('%') =~ 'Main' ? "\nmain :: IO ()\nmain = undefined" : ""`
|
||||
|
||||
snippet main
|
||||
main :: IO ()
|
||||
main = ${0:undefined}
|
||||
snippet const
|
||||
${1:name} :: ${2:a}
|
||||
$1 = ${0:undefined}
|
||||
@ -52,25 +57,21 @@ snippet fn
|
||||
snippet fn2
|
||||
${1:fn} :: ${2:a} -> ${3:a} -> ${4:a}
|
||||
$1 ${5} = ${0:undefined}
|
||||
snippet fn3
|
||||
${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} -> ${5:a}
|
||||
$1 ${6} = ${0:undefined}
|
||||
snippet => "Type constraint"
|
||||
(${1:Class} ${2:a}) => $2
|
||||
snippet ap
|
||||
${1:map} ${2:fn} ${0:list}
|
||||
snippet do
|
||||
do
|
||||
|
||||
snippet λ
|
||||
\\${1:x} -> ${0:expression}
|
||||
snippet \
|
||||
\\${1:x} -> ${0:expression}
|
||||
snippet (\
|
||||
(\\${1:x} -> ${0:expression})
|
||||
snippet <-
|
||||
${1:a} <- ${0:m a}
|
||||
snippet ←
|
||||
${1:a} <- ${0:m a}
|
||||
snippet ->
|
||||
${1:m a} -> ${0:a}
|
||||
snippet →
|
||||
${1:m a} -> ${0:a}
|
||||
snippet tup
|
||||
(${1:a}, ${0:b})
|
||||
snippet tup2
|
||||
@ -90,3 +91,25 @@ snippet let
|
||||
snippet where
|
||||
where
|
||||
${1:fn} = ${0:undefined}
|
||||
snippet spec
|
||||
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` (main, spec) where
|
||||
|
||||
import Test.Hspec
|
||||
import Test.QuickCheck
|
||||
|
||||
main :: IO ()
|
||||
main = hspec spec
|
||||
|
||||
spec :: Spec
|
||||
spec =
|
||||
describe "${1}" $ do
|
||||
$0
|
||||
snippet desc
|
||||
describe "${1}" $ do
|
||||
$0
|
||||
snippet it
|
||||
it "${1}" $
|
||||
$0
|
||||
snippet itp
|
||||
it "${1}" $ property $
|
||||
$0
|
||||
|
@ -159,18 +159,18 @@ snippet address
|
||||
${0}
|
||||
</address>
|
||||
snippet area
|
||||
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${0}" />
|
||||
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${0}">
|
||||
snippet area+
|
||||
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${4}" />
|
||||
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${4}">
|
||||
area+
|
||||
snippet area:c
|
||||
<area shape="circle" coords="${1}" href="${2}" alt="${0}" />
|
||||
<area shape="circle" coords="${1}" href="${2}" alt="${0}">
|
||||
snippet area:d
|
||||
<area shape="default" coords="${1}" href="${2}" alt="${0}" />
|
||||
<area shape="default" coords="${1}" href="${2}" alt="${0}">
|
||||
snippet area:p
|
||||
<area shape="poly" coords="${1}" href="${2}" alt="${0}" />
|
||||
<area shape="poly" coords="${1}" href="${2}" alt="${0}">
|
||||
snippet area:r
|
||||
<area shape="rect" coords="${1}" href="${2}" alt="${0}" />
|
||||
<area shape="rect" coords="${1}" href="${2}" alt="${0}">
|
||||
snippet article
|
||||
<article>
|
||||
${0}
|
||||
@ -200,7 +200,7 @@ snippet audio
|
||||
snippet b
|
||||
<b>${0}</b>
|
||||
snippet base
|
||||
<base href="${1}" target="${0}" />
|
||||
<base href="${1}" target="${0}">
|
||||
snippet bdi
|
||||
<bdi>${0}</bdo>
|
||||
snippet bdo
|
||||
@ -218,7 +218,7 @@ snippet body
|
||||
${0}
|
||||
</body>
|
||||
snippet br
|
||||
<br />
|
||||
<br>
|
||||
snippet button
|
||||
<button type="${1:submit}">${0}</button>
|
||||
snippet button.
|
||||
@ -240,9 +240,9 @@ snippet cite
|
||||
snippet code
|
||||
<code>${0}</code>
|
||||
snippet col
|
||||
<col />
|
||||
<col>
|
||||
snippet col+
|
||||
<col />
|
||||
<col>
|
||||
col+
|
||||
snippet colgroup
|
||||
<colgroup>
|
||||
@ -254,11 +254,11 @@ snippet colgroup+
|
||||
col+${0}
|
||||
</colgroup>
|
||||
snippet command
|
||||
<command type="command" label="${1}" icon="${0}" />
|
||||
<command type="command" label="${1}" icon="${0}">
|
||||
snippet command:c
|
||||
<command type="checkbox" label="${1}" icon="${0}" />
|
||||
<command type="checkbox" label="${1}" icon="${0}">
|
||||
snippet command:r
|
||||
<command type="radio" radiogroup="${1}" label="${2}" icon="${0}" />
|
||||
<command type="radio" radiogroup="${1}" label="${2}" icon="${0}">
|
||||
snippet datagrid
|
||||
<datagrid>
|
||||
${0}
|
||||
@ -330,7 +330,7 @@ snippet dt+
|
||||
snippet em
|
||||
<em>${0}</em>
|
||||
snippet embed
|
||||
<embed src="${1}" type="${0}" />
|
||||
<embed src="${1}" type="${0}">
|
||||
snippet fieldset
|
||||
<fieldset>
|
||||
${0}
|
||||
@ -423,7 +423,7 @@ snippet h6#
|
||||
<h6 id="${1}">${0}</h6>
|
||||
snippet head
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
|
||||
<title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
|
||||
${0}
|
||||
@ -449,7 +449,7 @@ snippet hgroup.
|
||||
${0}
|
||||
</hgroup>
|
||||
snippet hr
|
||||
<hr />
|
||||
<hr>
|
||||
snippet html
|
||||
<html>
|
||||
${0}
|
||||
@ -493,59 +493,59 @@ snippet iframe.
|
||||
snippet iframe#
|
||||
<iframe id="${1}" src="${2}" frameborder="0"></iframe>
|
||||
snippet img
|
||||
<img src="${1}" alt="${2}" />
|
||||
<img src="${1}" alt="${2}">
|
||||
snippet img.
|
||||
<img class="${1}" src="${2}" alt="${3}" />
|
||||
<img class="${1}" src="${2}" alt="${3}">
|
||||
snippet img#
|
||||
<img id="${1}" src="${2}" alt="${3}" />
|
||||
<img id="${1}" src="${2}" alt="${3}">
|
||||
snippet input
|
||||
<input type="${1:text/submit/hidden/button/image}" name="${2}" id="${3:$2}" value="${4}" />
|
||||
<input type="${1:text/submit/hidden/button/image}" name="${2}" id="${3:$2}" value="${4}">
|
||||
snippet input.
|
||||
<input class="${1}" type="${2:text/submit/hidden/button/image}" name="${3}" id="${4:$3}" value="${5}" />
|
||||
<input class="${1}" type="${2:text/submit/hidden/button/image}" name="${3}" id="${4:$3}" value="${5}">
|
||||
snippet input:text
|
||||
<input type="text" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="text" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:submit
|
||||
<input type="submit" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="submit" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:hidden
|
||||
<input type="hidden" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="hidden" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:button
|
||||
<input type="button" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="button" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:image
|
||||
<input type="image" name="${1}" id="${2:$1}" src="${3}" alt="${4}" />
|
||||
<input type="image" name="${1}" id="${2:$1}" src="${3}" alt="${4}">
|
||||
snippet input:checkbox
|
||||
<input type="checkbox" name="${1}" id="${2:$1}" />
|
||||
<input type="checkbox" name="${1}" id="${2:$1}">
|
||||
snippet input:radio
|
||||
<input type="radio" name="${1}" id="${2:$1}" />
|
||||
<input type="radio" name="${1}" id="${2:$1}">
|
||||
snippet input:color
|
||||
<input type="color" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="color" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:date
|
||||
<input type="date" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="date" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:datetime
|
||||
<input type="datetime" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="datetime" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:datetime-local
|
||||
<input type="datetime-local" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="datetime-local" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:email
|
||||
<input type="email" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="email" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:file
|
||||
<input type="file" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="file" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:month
|
||||
<input type="month" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="month" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:number
|
||||
<input type="number" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="number" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:password
|
||||
<input type="password" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="password" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:range
|
||||
<input type="range" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="range" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:reset
|
||||
<input type="reset" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="reset" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:search
|
||||
<input type="search" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="search" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:time
|
||||
<input type="time" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="time" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:url
|
||||
<input type="url" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="url" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:week
|
||||
<input type="week" name="${1}" id="${2:$1}" value="${3}" />
|
||||
<input type="week" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet ins
|
||||
<ins>${0}</ins>
|
||||
snippet kbd
|
||||
@ -579,19 +579,19 @@ snippet lia+
|
||||
<li><a href="${2:#}">${1}</a></li>
|
||||
lia+
|
||||
snippet link
|
||||
<link rel="${1}" href="${2}" title="${3}" type="${4}" />
|
||||
<link rel="${1}" href="${2}" title="${3}" type="${4}">
|
||||
snippet link:atom
|
||||
<link rel="alternate" href="${1:atom.xml}" title="Atom" type="application/atom+xml" />
|
||||
<link rel="alternate" href="${1:atom.xml}" title="Atom" type="application/atom+xml">
|
||||
snippet link:s
|
||||
<link rel="stylesheet" href="${1:style.css}" />
|
||||
<link rel="stylesheet" href="${1:style.css}">
|
||||
snippet link:css
|
||||
<link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}" />
|
||||
<link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}">
|
||||
snippet link:favicon
|
||||
<link rel="shortcut icon" href="${1:favicon.ico}" type="image/x-icon" />
|
||||
<link rel="shortcut icon" href="${1:favicon.ico}" type="image/x-icon">
|
||||
snippet link:rss
|
||||
<link rel="alternate" href="${1:rss.xml}" title="RSS" type="application/atom+xml" />
|
||||
<link rel="alternate" href="${1:rss.xml}" title="RSS" type="application/atom+xml">
|
||||
snippet link:touch
|
||||
<link rel="apple-touch-icon" href="${1:favicon.png}" />
|
||||
<link rel="apple-touch-icon" href="${1:favicon.png}">
|
||||
snippet main
|
||||
<main role="main">
|
||||
${0}
|
||||
@ -610,7 +610,7 @@ snippet map#
|
||||
</map>
|
||||
snippet map+
|
||||
<map name="${1}">
|
||||
<area shape="${2}" coords="${3}" href="${4}" alt="${5}" />${6}
|
||||
<area shape="${2}" coords="${3}" href="${4}" alt="${5}">${6}
|
||||
</map>
|
||||
snippet mark
|
||||
<mark>${0}</mark>
|
||||
@ -627,17 +627,17 @@ snippet menu:t
|
||||
${0}
|
||||
</menu>
|
||||
snippet meta
|
||||
<meta http-equiv="${1}" content="${2}" />
|
||||
<meta http-equiv="${1}" content="${2}">
|
||||
snippet meta:s
|
||||
<meta ${0} />
|
||||
<meta ${0}>
|
||||
snippet meta:d
|
||||
<meta name="description" content="${0}" />
|
||||
<meta name="description" content="${0}">
|
||||
snippet meta:compat
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=${1:7,8,edge}" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=${1:7,8,edge}">
|
||||
snippet meta:refresh
|
||||
<meta http-equiv="refresh" content="text/html;charset=UTF-8" />
|
||||
<meta http-equiv="refresh" content="text/html;charset=UTF-8">
|
||||
snippet meta:utf
|
||||
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
||||
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
|
||||
snippet meter
|
||||
<meter>${0}</meter>
|
||||
snippet nav
|
||||
@ -665,13 +665,13 @@ snippet movie
|
||||
<object width="$2" height="$3" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
|
||||
codebase="http://www.apple.com/qtactivex/qtplugin.cab">
|
||||
<param name="src" value="$1" />
|
||||
<param name="controller" value="$4" />
|
||||
<param name="autoplay" value="$5" />
|
||||
<param name="controller" value="$4">
|
||||
<param name="autoplay" value="$5">
|
||||
<embed src="${1:movie.mov}"
|
||||
width="${2:320}" height="${3:240}"
|
||||
controller="${4:true}" autoplay="${5:true}"
|
||||
scale="tofit" cache="true"
|
||||
pluginspage="http://www.apple.com/quicktime/download/" />
|
||||
pluginspage="http://www.apple.com/quicktime/download/">
|
||||
</object>
|
||||
snippet ol
|
||||
<ol>
|
||||
@ -711,7 +711,7 @@ snippet p.
|
||||
snippet p#
|
||||
<p id="${1}">${0}</p>
|
||||
snippet param
|
||||
<param name="${1}" value="${2}" />
|
||||
<param name="${1}" value="${2}">
|
||||
snippet pre
|
||||
<pre>
|
||||
${0}
|
||||
@ -774,7 +774,7 @@ snippet select+
|
||||
snippet small
|
||||
<small>${0}</small>
|
||||
snippet source
|
||||
<source src="${1}" type="${2}" media="${0}" />
|
||||
<source src="${1}" type="${2}" media="${0}">
|
||||
snippet span
|
||||
<span>${0}</span>
|
||||
snippet span.
|
||||
@ -876,4 +876,4 @@ snippet var
|
||||
snippet video
|
||||
<video src="${1} height="${2}" width="${3}" preload="${5:none}" autoplay="${6:autoplay}>${7}</video>
|
||||
snippet wbr
|
||||
<wbr />
|
||||
<wbr>
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Generic tags
|
||||
|
||||
extends html
|
||||
|
||||
snippet %
|
||||
{% ${1} %}
|
||||
snippet %%
|
||||
@ -138,4 +140,3 @@ snippet urlizetrunc
|
||||
urlizetrunc:${0}
|
||||
snippet wordwrap
|
||||
wordwrap:${0}
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
snippet const
|
||||
const ${0} = ${1};
|
||||
snippet let
|
||||
let ${0} = ${1};
|
||||
snippet im
|
||||
import ${0} from '${1}';
|
||||
snippet cla
|
||||
class ${0} {
|
||||
${1}
|
||||
}
|
||||
snippet clax
|
||||
class ${0} extends ${1} {
|
||||
${2}
|
||||
}
|
||||
snippet =>
|
||||
(${0}) => {
|
||||
${1}
|
||||
}
|
||||
snippet sym
|
||||
const ${0} = Symbol('${1}');
|
||||
snippet ed
|
||||
export default ${0}
|
@ -11,7 +11,7 @@ snippet fun
|
||||
${0}
|
||||
}
|
||||
# Anonymous Function
|
||||
snippet f
|
||||
snippet f "" w
|
||||
function(${1}) {
|
||||
${0}
|
||||
}
|
||||
@ -80,6 +80,18 @@ snippet try
|
||||
} catch (${2:e}) {
|
||||
${0:/* handle error */}
|
||||
}
|
||||
# try finally
|
||||
snippet tryf
|
||||
try {
|
||||
${1}
|
||||
} catch (${2:e}) {
|
||||
${0:/* handle error */}
|
||||
} finally {
|
||||
${3:/* be executed regardless of the try / catch result*/}
|
||||
}
|
||||
# throw Error
|
||||
snippet terr
|
||||
throw new Error('${1:error message}')
|
||||
# return
|
||||
snippet ret
|
||||
return ${0:result};
|
||||
@ -88,12 +100,12 @@ snippet ret
|
||||
|
||||
# for loop
|
||||
snippet for
|
||||
for (var ${2:i} = 0, l = ${1:arr}.length; $2 < l; $2 ++) {
|
||||
for (var ${2:i} = 0, l = ${1:arr}.length; $2 < l; $2++) {
|
||||
var ${3:v} = $1[$2];${0:}
|
||||
}
|
||||
# Reversed for loop
|
||||
snippet forr
|
||||
for (var ${2:i} = ${1:arr}.length - 1; $2 >= 0; $2 --) {
|
||||
for (var ${2:i} = ${1:arr}.length - 1; $2 >= 0; $2--) {
|
||||
var ${3:v} = $1[$2];${0:}
|
||||
}
|
||||
# While loop
|
||||
@ -203,7 +215,6 @@ snippet @par
|
||||
@param {${1:type}} ${2:name} ${0:description}
|
||||
snippet @ret
|
||||
@return {${1:type}} ${0:description}
|
||||
|
||||
# JSON
|
||||
|
||||
# JSON.parse
|
||||
@ -243,6 +254,9 @@ snippet cl
|
||||
# console.debug
|
||||
snippet cd
|
||||
console.debug(${0});
|
||||
# console.err
|
||||
snippet ce
|
||||
console.err(${0});
|
||||
# console.trace
|
||||
snippet ct
|
||||
console.trace(${0:label});
|
||||
|
116
sources_non_forked/vim-snippets/snippets/perl6.snippets
Normal file
116
sources_non_forked/vim-snippets/snippets/perl6.snippets
Normal file
@ -0,0 +1,116 @@
|
||||
# shebang
|
||||
snippet #!
|
||||
#!/usr/bin/env perl6
|
||||
|
||||
# Hash Pointer
|
||||
snippet .
|
||||
=>
|
||||
# Function
|
||||
snippet sub
|
||||
sub ${1:function_name}(${2:Str $var}) {
|
||||
${3}
|
||||
}
|
||||
snippet mul
|
||||
multi ${1:function_name}(${2:Str $var}) {
|
||||
${3}
|
||||
}
|
||||
# Conditional
|
||||
snippet if
|
||||
if ${1} {
|
||||
${2}
|
||||
}
|
||||
# Conditional if..else
|
||||
snippet ife
|
||||
if ${1} {
|
||||
${2}
|
||||
}
|
||||
else {
|
||||
${3}
|
||||
}
|
||||
snippet eif
|
||||
elsif ${1) {
|
||||
${2}
|
||||
}
|
||||
# Conditional One-line
|
||||
snippet xif
|
||||
${1:expression} if ${2:condition};
|
||||
# Unless conditional
|
||||
snippet unless
|
||||
unless ${1} {
|
||||
${2}
|
||||
}
|
||||
# Unless conditional One-line
|
||||
snippet xunless
|
||||
${1:expression} unless ${2:condition};
|
||||
# Ternary conditional
|
||||
snippet tc
|
||||
${1:condition} ?? ${2:value-if-true} !! ${3:value-if-false};
|
||||
# given - when (perl6 switch)
|
||||
snippet switch
|
||||
given ${1:$var} {
|
||||
when ${2:condition} {
|
||||
${3:# code block ...}
|
||||
}
|
||||
${4}
|
||||
default {
|
||||
${5}
|
||||
}
|
||||
}
|
||||
# 'loop' - C's for.
|
||||
snippet loop
|
||||
loop (my ${1:$i} = 0; $$1 < ${2:count}; $$1++) {
|
||||
${3}
|
||||
}
|
||||
# for loop
|
||||
snippet for
|
||||
for ${1:@array} -> ${2:$variable} {
|
||||
${3}
|
||||
}
|
||||
# While Loop
|
||||
snippet wh
|
||||
while ${1} {
|
||||
${2}
|
||||
}
|
||||
# Repeat while and repean until
|
||||
snippet rp
|
||||
repeat {
|
||||
${1}
|
||||
} ${2:while|until} ${3};
|
||||
# classes ..
|
||||
snippet cl
|
||||
${1:my} class ${2:ClassName} ${3:is|does Parent|Role}{
|
||||
${4}
|
||||
}
|
||||
snippet has
|
||||
has ${1:Type} ${2:$!identifier};
|
||||
snippet mth
|
||||
method ${1:method_name}(${2:$attr}) {
|
||||
${3}
|
||||
}
|
||||
snippet pmth
|
||||
method ${1:!}${2:method_name}(${3:$attr}) {
|
||||
${4}
|
||||
}
|
||||
snippet smth
|
||||
submethod ${1:submethod_name}(${2:$attr}) {
|
||||
${3}
|
||||
}
|
||||
# Tests
|
||||
snippet test
|
||||
use v6;
|
||||
use Test;
|
||||
${1:use lib 'lib';}
|
||||
|
||||
plan ${2:$num-tests};
|
||||
|
||||
# IO
|
||||
snippet slurp
|
||||
my ${1:$var} = "${2:filename}".IO.slurp;
|
||||
snippet rfile
|
||||
for "${1:filename}".IO.lines -> $line {
|
||||
${2}
|
||||
}
|
||||
snippet open
|
||||
my $fh = open "${1:filename}", ${2::r|:w|:a};
|
||||
${3:# actions};
|
||||
$fh.close;
|
@ -601,4 +601,5 @@ snippet tc
|
||||
{
|
||||
${0:code}
|
||||
}
|
||||
|
||||
snippet te
|
||||
throw new ${1:Exception}("${2:Error Processing Request}");
|
||||
|
@ -221,7 +221,7 @@ snippet package
|
||||
|
||||
snippet yumrepo
|
||||
yumrepo { "${1:repo name}":
|
||||
Descr => "${2:$1}",
|
||||
descr => "${2:$1}",
|
||||
enabled => ${0:1},
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
snippet #!
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
snippet #!3
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
snippet imp
|
||||
import ${0:module}
|
||||
snippet uni
|
||||
@ -145,6 +148,9 @@ snippet ptpython
|
||||
# python console debugger (pudb)
|
||||
snippet pudb
|
||||
import pudb; pudb.set_trace()
|
||||
# pdb in nosetests
|
||||
snippet nosetrace
|
||||
from nose.tools import set_trace; set_trace()
|
||||
snippet pprint
|
||||
import pprint; pprint.pprint(${1})
|
||||
snippet "
|
||||
|
@ -56,11 +56,40 @@ snippet err:
|
||||
snippet cau:
|
||||
.. caution::
|
||||
${0:Watch out!}
|
||||
#Spinx only
|
||||
#Sphinx only
|
||||
snippet sid:
|
||||
.. sidebar:: ${1:Title}
|
||||
|
||||
${0}
|
||||
snippet tod:
|
||||
.. todo::
|
||||
${0}
|
||||
snippet lis:
|
||||
.. list-table:: ${0:Title}
|
||||
:header-rows: 1
|
||||
:stub-columns: 1
|
||||
|
||||
* - x1,y1
|
||||
- x2,y1
|
||||
- x3,y1
|
||||
* - x1,y2
|
||||
- x2,y2
|
||||
- x3,y2
|
||||
* - x1,y3
|
||||
- x2,y3
|
||||
- x3,y3
|
||||
|
||||
snippet toc:
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
${0}
|
||||
snippet dow:
|
||||
:download:`${0:text} <${1:path}>`
|
||||
snippet ref:
|
||||
:ref:`${0:text} <${1:path}>`
|
||||
snippet doc:
|
||||
:doc:`${0:text} <${1:path}>`
|
||||
# CJK optimize, CJK has no space between charaters
|
||||
snippet *c
|
||||
\ *${1:Emphasis}*\ ${0}
|
||||
|
@ -1,12 +1,7 @@
|
||||
# encoding for Ruby 1.9
|
||||
snippet enc
|
||||
# encoding: utf-8
|
||||
|
||||
# #!/usr/bin/env ruby
|
||||
snippet #!
|
||||
#!/usr/bin/env ruby
|
||||
# encoding: utf-8
|
||||
|
||||
# New Block
|
||||
snippet =b
|
||||
=begin rdoc
|
||||
@ -29,15 +24,12 @@ snippet beg
|
||||
${0}
|
||||
rescue ${1:Exception} => ${2:e}
|
||||
end
|
||||
|
||||
snippet req require
|
||||
require '${1}'
|
||||
snippet reqr
|
||||
require_relative '${1}'
|
||||
snippet #
|
||||
# =>
|
||||
snippet end
|
||||
__END__
|
||||
snippet case
|
||||
case ${1:object}
|
||||
when ${2:condition}
|
||||
@ -115,7 +107,7 @@ snippet cla class .. end
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
${0}
|
||||
end
|
||||
snippet cla class .. initialize .. end
|
||||
snippet clai class .. initialize .. end
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
def initialize(${2:args})
|
||||
${0}
|
||||
|
@ -7,6 +7,10 @@ snippet fn "Function definition"
|
||||
fn ${1:function_name}(${2})${3} {
|
||||
${0}
|
||||
}
|
||||
snippet pfn "Function definition"
|
||||
pub fn ${1:function_name}(${2})${3} {
|
||||
${0}
|
||||
}
|
||||
snippet test "Unit test function"
|
||||
#[test]
|
||||
fn ${1:test_function_name}() {
|
||||
@ -106,7 +110,7 @@ snippet loop "loop {}" b
|
||||
loop {
|
||||
${0}
|
||||
}
|
||||
snippet while "while loop"
|
||||
snippet wh "while loop"
|
||||
while ${1:condition} {
|
||||
${0}
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
extends css
|
||||
|
||||
snippet $
|
||||
$${1:variable}: ${0:value};
|
||||
snippet imp
|
||||
@ -8,7 +10,7 @@ snippet mix
|
||||
}
|
||||
snippet inc
|
||||
@include ${1:mixin}(${2});
|
||||
snippet ex
|
||||
snippet ext
|
||||
@extend ${0};
|
||||
snippet fun
|
||||
@function ${1:name}(${2:args}) {
|
||||
|
122
sources_non_forked/vim-snippets/snippets/simplemvcf.snippets
Normal file
122
sources_non_forked/vim-snippets/snippets/simplemvcf.snippets
Normal file
@ -0,0 +1,122 @@
|
||||
snippet sm_controller
|
||||
<?php
|
||||
namespace Controllers;
|
||||
use Core\View;
|
||||
use Core\Controller;
|
||||
|
||||
class ${1:class_name} extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
${2:}
|
||||
}
|
||||
}
|
||||
snippet sm_model
|
||||
<?php
|
||||
namespace Models;
|
||||
|
||||
use Core\Model;
|
||||
|
||||
class ${1:class_name} extends Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
snippet sm_model_crud
|
||||
<?php
|
||||
namespace Models;
|
||||
|
||||
use Core\Model;
|
||||
|
||||
class ${1:class_name} extends Model
|
||||
{
|
||||
private $${2:table};
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getRow($where)
|
||||
{
|
||||
return $this->db->select('SELECT * FROM '.$table.' WHERE ${3:where}', $data);
|
||||
}
|
||||
|
||||
public function getRows($where)
|
||||
{
|
||||
return $this->db->select('SELECT * FROM '.$table.');
|
||||
}
|
||||
|
||||
public function insert($data)
|
||||
{
|
||||
$this->db->insert($table, $data);
|
||||
}
|
||||
|
||||
public function update($data, $where)
|
||||
{
|
||||
$this->db->update($table ,$data, $where);
|
||||
}
|
||||
|
||||
public function delete($where)
|
||||
{
|
||||
$this->db->delete($table, $where);
|
||||
}
|
||||
}
|
||||
snippet sm_render
|
||||
View::render('${1:view}', $${2:array});
|
||||
snippet sm_render_template
|
||||
View::renderTemplate('${1:part}', $${2:array});
|
||||
|
||||
# database
|
||||
snippet sm_db_select
|
||||
$this->db->select(${1:sql}, ${2:where});
|
||||
|
||||
snippet sm_db_insert
|
||||
$this->db->insert(${1:table}, ${2:data});
|
||||
|
||||
snippet sm_db_update
|
||||
$this->db->update(${1:table}, ${2:data}, ${3:where});
|
||||
|
||||
snippet sm_db_delete
|
||||
$this->db->delete(${1:table}, ${2:where});
|
||||
|
||||
snippet sm_db_truncate
|
||||
$this->db->delete(${1:table});
|
||||
|
||||
#session
|
||||
snippet sm_session_set
|
||||
Session::set(${1:key}, ${2:value});
|
||||
|
||||
snippet sm_session_get
|
||||
Session::get(${1:key});
|
||||
|
||||
snippet sm_session_pull
|
||||
Session::pull(${1:key});
|
||||
|
||||
snippet sm_session_id
|
||||
Session::id();
|
||||
|
||||
snippet sm_session_destroy
|
||||
Session::set(${1:key});
|
||||
|
||||
snippet sm_session_display
|
||||
Session::display();
|
||||
|
||||
#url
|
||||
snippet sm_url_redirect
|
||||
Url:redirect('${1:path}');
|
||||
|
||||
snippet sm_url_previous
|
||||
Url:previous();
|
||||
|
||||
snippet sm_url_templatepath
|
||||
Url:templatePath();
|
||||
|
||||
snippet sm_url_autolink
|
||||
Url:autolink('${1:string}');
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,22 @@
|
||||
snippet b
|
||||
(
|
||||
${0}
|
||||
)
|
||||
snippet if
|
||||
if (${1}) {
|
||||
${0}
|
||||
}
|
||||
snippet ife
|
||||
if (${1}) {
|
||||
${2}
|
||||
} {
|
||||
${0}
|
||||
}
|
||||
snippet for
|
||||
for (${1:1}, ${2:10}) { |i|
|
||||
${0}
|
||||
}
|
||||
snippet sdef
|
||||
SynthDef(\\${1:synthName}, {${2}
|
||||
${0}
|
||||
}).add;
|
@ -76,6 +76,14 @@ snippet enum enumerate environment
|
||||
\begin{enumerate}
|
||||
\item ${0}
|
||||
\end{enumerate}
|
||||
snippet enuma enumerate environment
|
||||
\begin{enumerate}[(a)]
|
||||
\item ${0}
|
||||
\end{enumerate}
|
||||
snippet enumi enumerate environment
|
||||
\begin{enumerate}[(i)]
|
||||
\item ${0}
|
||||
\end{enumerate}
|
||||
# Itemize
|
||||
snippet itemize itemize environment
|
||||
\begin{itemize}
|
||||
@ -249,7 +257,7 @@ snippet frac \frac{}{}
|
||||
snippet sum \sum^{}_{}
|
||||
\sum^{${1:n}}_{${2:i=1}} ${0}
|
||||
snippet lim \lim_{}
|
||||
\lim_{${1:x \to +\infty}} ${0}
|
||||
\lim_{${1:n \to \infty}} ${0}
|
||||
snippet frame frame environment
|
||||
\begin{frame}[${1:t}]{${2:title}}
|
||||
${0}
|
||||
@ -275,7 +283,11 @@ snippet col2 two-column environment
|
||||
${0}
|
||||
\end{column}
|
||||
\end{columns}
|
||||
snippet \{ \{ \}
|
||||
\\{ ${0} \\}
|
||||
#delimiter
|
||||
snippet lr left right
|
||||
\left${1} ${0} \right$1
|
||||
snippet lr( left( right)
|
||||
\left( ${0} \right)
|
||||
snippet lr| left| right|
|
||||
@ -286,7 +298,6 @@ snippet lr[ left[ right]
|
||||
\left[ ${0} \right]
|
||||
snippet lra langle rangle
|
||||
\langle ${0} \rangle
|
||||
|
||||
# Code listings
|
||||
snippet lst
|
||||
\begin{listing}[language=${1:language}]
|
||||
|
@ -1,15 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SPACED=$(grep -REn '^ .+' --include '*.snippets' snippets);
|
||||
SPACED=$(grep -REn '^ .+' --include '*.snippets' snippets)
|
||||
|
||||
if [[ $? -ne 1 ]]; then
|
||||
echo These snippet lines are indented with spaces:;
|
||||
echo;
|
||||
echo "$SPACED";
|
||||
echo;
|
||||
echo These snippet lines are indented with spaces:
|
||||
echo
|
||||
echo "$SPACED"
|
||||
echo
|
||||
echo Tests failed!
|
||||
exit 1;
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo Tests passed!
|
||||
exit 0;
|
||||
exit 0
|
||||
|
Reference in New Issue
Block a user