1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Updated plugins

This commit is contained in:
amix
2015-12-08 10:20:04 -03:00
parent 768c72a3ed
commit 3b37bba6cd
239 changed files with 8132 additions and 3198 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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}"
});

View File

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

View File

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

View File

@ -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")`}

View File

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

View File

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

View File

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

View File

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

View File

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