mirror of
https://github.com/amix/vimrc
synced 2025-07-18 17:44:59 +08:00
merge
This commit is contained in:
@ -5,16 +5,14 @@ global !p
|
||||
def ada_case(word):
|
||||
out = word[0].upper()
|
||||
for i in range(1, len(word)):
|
||||
if word[i - 1] == '_':
|
||||
if word[i] == '-':
|
||||
out = out + '.'
|
||||
elif word[i - 1] == '_' or word[i - 1] == '-':
|
||||
out = out + word[i].upper()
|
||||
else:
|
||||
out = out + word[i]
|
||||
return out
|
||||
|
||||
def get_year():
|
||||
import time
|
||||
return time.strftime("%Y")
|
||||
|
||||
endglobal
|
||||
|
||||
snippet wi "with"
|
||||
@ -281,44 +279,4 @@ snippet newline "Ada.Text_IO.New_Line"
|
||||
Ada.Text_IO.New_Line(${1:1});$0
|
||||
endsnippet
|
||||
|
||||
snippet gpl "GPL license header"
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU ${1}General Public License as published by
|
||||
-- the Free Software Foundation; either version ${2:3} of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU $1General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU $1General Public License
|
||||
-- along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- Copyright (C) ${3:Author}, ${4:`!p snip.rv = get_year()`}
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet gplf "GPL file license header"
|
||||
-- This file is part of ${1:Program-Name}.
|
||||
--
|
||||
-- $1 is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU ${2}General Public License as published by
|
||||
-- the Free Software Foundation, either version ${3:3} of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- $1 is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU $2General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU $2General Public License
|
||||
-- along with $1. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- Copyright (C) ${4:Author}, ${5:`!p snip.rv = get_year()`}
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -10,104 +10,47 @@ 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 flags[0] == 's' 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 flags[0] == 'b':
|
||||
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
|
||||
`!p
|
||||
box = make_box(len(t[1]))
|
||||
snip.rv = box[0] + '\n' + box[1]
|
||||
`${1:content}`!p
|
||||
snip.rv = box[0]
|
||||
snip += box[1]
|
||||
`${1:${VISUAL:content}}`!p
|
||||
box = make_box(len(t[1]))
|
||||
snip.rv = box[2] + '\n' + box[3]`
|
||||
snip.rv = box[2]
|
||||
snip += box[3]`
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet bbox "A nice box over the full width" b
|
||||
`!p
|
||||
width = int(vim.eval("&textwidth")) or 71
|
||||
if not snip.c:
|
||||
width = int(vim.eval("&textwidth - (virtcol('.') == 1 ? 0 : virtcol('.'))")) or 71
|
||||
box = make_box(len(t[1]), width)
|
||||
snip.rv = box[0] + '\n' + box[1]
|
||||
`${1:content}`!p
|
||||
snip.rv = box[0]
|
||||
snip += box[1]
|
||||
`${1:${VISUAL:content}}`!p
|
||||
box = make_box(len(t[1]), width)
|
||||
snip.rv = box[2] + '\n' + box[3]`
|
||||
snip.rv = box[2]
|
||||
snip += box[3]`
|
||||
$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
|
||||
|
||||
##########################
|
||||
@ -130,4 +73,31 @@ snippet modeline "Vim modeline"
|
||||
vim`!v ':set '. (&expandtab ? printf('et sw=%i ts=%i', &sw, &ts) : printf('noet sts=%i sw=%i ts=%i', &sts, &sw, &ts)) . (&tw ? ' tw='. &tw : '') . ':'`
|
||||
endsnippet
|
||||
|
||||
#########
|
||||
# DATES #
|
||||
#########
|
||||
snippet date "YYYY-MM-DD" w
|
||||
`!v strftime("%F")`
|
||||
endsnippet
|
||||
|
||||
snippet ddate "Month DD, YYYY" w
|
||||
`!v strftime("%b %d, %Y")`
|
||||
endsnippet
|
||||
|
||||
snippet diso "ISO format datetime" w
|
||||
`!v strftime("%F %H:%M:%S%z")`
|
||||
endsnippet
|
||||
|
||||
snippet time "hh:mm" w
|
||||
`!v strftime("%H:%M")`
|
||||
endsnippet
|
||||
|
||||
snippet datetime "YYYY-MM-DD hh:mm" w
|
||||
`!v strftime("%Y-%m-%d %H:%M")`
|
||||
endsnippet
|
||||
|
||||
snippet todo "TODO comment" bw
|
||||
`!p snip.rv=get_comment_format()[0]` ${2:TODO}: $0${3: <${4:`!v strftime('%d-%m-%y')`}${5:, `!v g:snips_author`}>} `!p snip.rv=get_comment_format()[2]`
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -5,29 +5,21 @@
|
||||
priority -50
|
||||
|
||||
snippet def "#define ..."
|
||||
#define ${1}
|
||||
#define $1
|
||||
endsnippet
|
||||
|
||||
snippet ifndef "#ifndef ... #define ... #endif"
|
||||
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
|
||||
#if ${1:0}
|
||||
${VISUAL}${0}
|
||||
${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 -
|
||||
@ -40,29 +32,23 @@ endsnippet
|
||||
snippet main "main() (main)"
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
return 0;
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "for loop (for)"
|
||||
for (${2:i} = 0; $2 < ${1:count}; ${3:++$2})
|
||||
{
|
||||
${VISUAL}${0}
|
||||
for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fori "for int loop (fori)"
|
||||
for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2})
|
||||
{
|
||||
${VISUAL}${0}
|
||||
for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet enum "Enumeration"
|
||||
enum ${1:name} { $0 };
|
||||
endsnippet
|
||||
|
||||
snippet once "Include header once only guard"
|
||||
#ifndef ${1:`!p
|
||||
if not snip.c:
|
||||
@ -74,58 +60,18 @@ else:
|
||||
snip.rv = snip.c`}
|
||||
#define $1
|
||||
|
||||
${VISUAL}${0}
|
||||
${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
|
||||
|
||||
snippet if "if .. (if)"
|
||||
if (${1:/* condition */})
|
||||
{
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet el "else .. (else)"
|
||||
else {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet eli "else if .. (eli)"
|
||||
else if (${1:/* condition */}) {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ife "if .. else (ife)"
|
||||
if (${1:/* condition */})
|
||||
{
|
||||
${2}
|
||||
}
|
||||
else
|
||||
{
|
||||
${3:/* else */}
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -134,21 +80,20 @@ printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2
|
||||
endsnippet
|
||||
|
||||
snippet st "struct"
|
||||
struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`}
|
||||
{
|
||||
struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`} {
|
||||
${0:/* data */}
|
||||
};
|
||||
endsnippet
|
||||
|
||||
snippet fun "function" b
|
||||
${1:void} ${2:function_name}(${3})
|
||||
${1:void} ${2:function_name}($3)
|
||||
{
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fund "function declaration" b
|
||||
${1:void} ${2:function_name}(${3});
|
||||
${1:void} ${2:function_name}($3);
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -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
|
||||
|
@ -4,6 +4,28 @@ extends c
|
||||
|
||||
# We want to overwrite everything in parent ft.
|
||||
priority -49
|
||||
###########################################################################
|
||||
# Global functions #
|
||||
###########################################################################
|
||||
|
||||
global !p
|
||||
|
||||
def write_docstring_args(arglist, snip):
|
||||
args = str(arglist).split(',')
|
||||
|
||||
if len(args) > 1:
|
||||
c = 0
|
||||
for arg in args:
|
||||
if c == 0:
|
||||
snip.rv += arg
|
||||
c = 1
|
||||
else:
|
||||
snip += '* : %s' % arg.strip()
|
||||
else:
|
||||
snip.rv = args[0]
|
||||
|
||||
|
||||
endglobal
|
||||
|
||||
###########################################################################
|
||||
# TextMate Snippets #
|
||||
@ -27,7 +49,7 @@ endsnippet
|
||||
snippet ns "namespace .. (namespace)"
|
||||
namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`}
|
||||
{
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
}${1/.+/ \/* /m}$1${1/.+/ *\/ /m}
|
||||
endsnippet
|
||||
|
||||
@ -54,4 +76,35 @@ snippet tp "template <typename ..> (template)"
|
||||
template <typename ${1:_InputIter}>
|
||||
endsnippet
|
||||
|
||||
snippet cla "An entire .h generator" b
|
||||
#ifndef ${2:`!v substitute(vim_snippets#Filename('$1_H','ClassName'),'.*','\U&\E','')`}
|
||||
#define $2
|
||||
|
||||
class ${1:`!v substitute(substitute(vim_snippets#Filename('$1','ClassName'),'^.','\u&',''), '_\(\w\)', '\u\1', 'g')`}
|
||||
{
|
||||
private:
|
||||
$3
|
||||
|
||||
public:
|
||||
$1();
|
||||
virtual ~$1();
|
||||
};
|
||||
|
||||
#endif /* $2 */
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet fnc "Basic c++ doxygen function template" b
|
||||
/**
|
||||
* @brief: ${4:brief}
|
||||
*
|
||||
* @param: `!p write_docstring_args(t[3],snip)`
|
||||
*
|
||||
* @return: `!p snip.rv = t[1]`
|
||||
*/
|
||||
${1:ReturnType} ${2:FunctionName}(${3:param})
|
||||
{
|
||||
${0:FunctionBody}
|
||||
}
|
||||
endsnippet
|
||||
# vim:ft=snippets:
|
||||
|
13
sources_non_forked/vim-snippets/UltiSnips/crystal.snippets
Normal file
13
sources_non_forked/vim-snippets/UltiSnips/crystal.snippets
Normal file
@ -0,0 +1,13 @@
|
||||
priority -50
|
||||
|
||||
snippet "\b(de)?f" "def <name>..." r
|
||||
def ${1:method_name}${2:(${3:*args})}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet "\b(pde)?f" "private def <name>..." r
|
||||
private def ${1:method_name}${2:(${3:*args})}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
@ -16,7 +16,7 @@ namespace ${1:MyNamespace}
|
||||
endsnippet
|
||||
|
||||
snippet class "class" w
|
||||
class ${1:MyClass}
|
||||
${1:public} class ${2:MyClass}
|
||||
{
|
||||
$0
|
||||
}
|
||||
@ -259,7 +259,7 @@ finally
|
||||
endsnippet
|
||||
|
||||
snippet throw "throw"
|
||||
throw new ${1}Exception("${2}");
|
||||
throw new $1Exception("$2");
|
||||
endsnippet
|
||||
|
||||
|
||||
@ -288,6 +288,10 @@ snippet cw "Console.WriteLine" b
|
||||
Console.WriteLine("$1");
|
||||
endsnippet
|
||||
|
||||
snippet cr "Console.ReadLine" b
|
||||
Console.ReadLine();
|
||||
endsnippet
|
||||
|
||||
# as you first type comma-separated parameters on the right, {n} values appear in the format string
|
||||
snippet cwp "Console.WriteLine with parameters" b
|
||||
Console.WriteLine("${2:`!p
|
||||
@ -300,9 +304,9 @@ MessageBox.Show("${1:message}");
|
||||
endsnippet
|
||||
|
||||
|
||||
##################
|
||||
# full methods #
|
||||
##################
|
||||
#############
|
||||
# methods #
|
||||
#############
|
||||
|
||||
snippet equals "Equals method" b
|
||||
public override bool Equals(object obj)
|
||||
@ -316,13 +320,53 @@ public override bool Equals(object obj)
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet mth "Method" b
|
||||
${1:public} ${2:void} ${3:MyMethod}(${4})
|
||||
{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet mths "Static method" b
|
||||
${1:public} static ${2:void} ${3:MyMethod}(${4})
|
||||
{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
###############
|
||||
# constructor #
|
||||
###############
|
||||
|
||||
snippet ctor "Constructor" b
|
||||
${1:public} ${2:`!p snip.rv = snip.basename or "untitled"`}(${3})
|
||||
{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
##############
|
||||
# comments #
|
||||
##############
|
||||
|
||||
snippet /// "XML comment" b
|
||||
snippet /// "XML summary comment" b
|
||||
/// <summary>
|
||||
/// $1
|
||||
/// $0
|
||||
/// </summary>
|
||||
endsnippet
|
||||
|
||||
snippet <p "XML pramameter comment" b
|
||||
<param name="${1}">${2}</param>
|
||||
endsnippet
|
||||
|
||||
snippet <ex "XML exception comment" b
|
||||
<exception cref="${1:System.Exception}">${2}</exception>
|
||||
endsnippet
|
||||
|
||||
snippet <r "XML returns comment" b
|
||||
<returns>$0</returns>
|
||||
endsnippet
|
||||
|
||||
snippet <c "XML code comment" b
|
||||
<code>$0</code>
|
||||
endsnippet
|
||||
|
@ -1,11 +1,5 @@
|
||||
priority -50
|
||||
|
||||
snippet . "selector { }"
|
||||
$1 {
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet p "padding"
|
||||
padding: ${1:0};$0
|
||||
endsnippet
|
||||
|
5
sources_non_forked/vim-snippets/UltiSnips/cuda.snippets
Normal file
5
sources_non_forked/vim-snippets/UltiSnips/cuda.snippets
Normal file
@ -0,0 +1,5 @@
|
||||
priority -50
|
||||
|
||||
extends cpp
|
||||
|
||||
# vim:ft=snippets:
|
@ -23,7 +23,7 @@ mixin ${1:/*mixed_in*/} ${2:/*name*/};
|
||||
endsnippet
|
||||
|
||||
snippet new "new (new)"
|
||||
new ${1}(${2});
|
||||
new $1($2);
|
||||
endsnippet
|
||||
|
||||
snippet scpn "@safe const pure nothrow (scpn)"
|
||||
@ -98,7 +98,7 @@ endsnippet
|
||||
|
||||
snippet enf "enforce (enf)" b
|
||||
enforce(${1:/*condition*/},
|
||||
new ${2}Exception(${3:/*args*/}));
|
||||
new $2Exception(${3:/*args*/}));
|
||||
endsnippet
|
||||
|
||||
# Branches
|
||||
@ -106,14 +106,14 @@ endsnippet
|
||||
snippet if "if .. (if)"
|
||||
if(${1:/*condition*/})
|
||||
{
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ife "if .. else (ife)" b
|
||||
if(${1:/*condition*/})
|
||||
{
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -124,14 +124,14 @@ endsnippet
|
||||
snippet el "else (el)" b
|
||||
else
|
||||
{
|
||||
${VISUAL}${1}
|
||||
${VISUAL}$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet elif "else if (elif)" b
|
||||
else if(${1:/*condition*/})
|
||||
{
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -139,10 +139,10 @@ snippet sw "switch (sw)"
|
||||
switch(${1:/*var*/})
|
||||
{
|
||||
case ${2:/*value*/}:
|
||||
${3}
|
||||
$3
|
||||
break;
|
||||
case ${4:/*value*/}:
|
||||
${5}
|
||||
$5
|
||||
break;
|
||||
${7:/*more cases*/}
|
||||
default:
|
||||
@ -154,10 +154,10 @@ snippet fsw "final switch (fsw)"
|
||||
final switch(${1:/*var*/})
|
||||
{
|
||||
case ${2:/*value*/}:
|
||||
${3}
|
||||
$3
|
||||
break;
|
||||
case ${4:/*value*/}:
|
||||
${5}
|
||||
$5
|
||||
break;
|
||||
${7:/*more cases*/}
|
||||
}
|
||||
@ -165,7 +165,7 @@ endsnippet
|
||||
|
||||
snippet case "case (case)" b
|
||||
case ${1:/*value*/}:
|
||||
${2}
|
||||
$2
|
||||
break;
|
||||
endsnippet
|
||||
|
||||
@ -178,42 +178,42 @@ endsnippet
|
||||
snippet do "do while (do)" b
|
||||
do
|
||||
{
|
||||
${VISUAL}${2}
|
||||
${VISUAL}$2
|
||||
} while(${1:/*condition*/});
|
||||
endsnippet
|
||||
|
||||
snippet wh "while (wh)" b
|
||||
while(${1:/*condition*/})
|
||||
{
|
||||
${VISUAL}${2}
|
||||
${VISUAL}$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "for (for)" b
|
||||
for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2})
|
||||
{
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet forever "forever (forever)" b
|
||||
for(;;)
|
||||
{
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fore "foreach (fore)"
|
||||
foreach(${1:/*elem*/}; ${2:/*range*/})
|
||||
{
|
||||
${VISUAL}${3}
|
||||
${VISUAL}$3
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet forif "foreach if (forif)" b
|
||||
foreach(${1:/*elem*/}; ${2:/*range*/}) if(${3:/*condition*/})
|
||||
{
|
||||
${VISUAL}${4}
|
||||
${VISUAL}$4
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -222,7 +222,7 @@ snippet in "in contract (in)" b
|
||||
in
|
||||
{
|
||||
assert(${1:/*condition*/}, "${2:error message}");
|
||||
${3}
|
||||
$3
|
||||
}
|
||||
body
|
||||
endsnippet
|
||||
@ -231,7 +231,7 @@ snippet out "out contract (out)" b
|
||||
out${1:(result)}
|
||||
{
|
||||
assert(${2:/*condition*/}, "${3:error message}");
|
||||
${4}
|
||||
$4
|
||||
}
|
||||
body
|
||||
endsnippet
|
||||
@ -240,7 +240,7 @@ snippet inv "invariant (inv)" b
|
||||
invariant()
|
||||
{
|
||||
assert(${1:/*condition*/}, "${2:error message}");
|
||||
${3}
|
||||
$3
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -249,21 +249,21 @@ endsnippet
|
||||
snippet fun "function definition (fun)"
|
||||
${1:void} ${2:/*function name*/}(${3:/*args*/}) ${4:@safe pure nothrow}
|
||||
{
|
||||
${VISUAL}${5}
|
||||
${VISUAL}$5
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet void "void function definition (void)"
|
||||
void ${1:/*function name*/}(${2:/*args*/}) ${3:@safe pure nothrow}
|
||||
{
|
||||
${VISUAL}${4}
|
||||
${VISUAL}$4
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet this "ctor (this)" w
|
||||
this(${1:/*args*/})
|
||||
{
|
||||
${VISUAL}${2}
|
||||
${VISUAL}$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -295,16 +295,16 @@ endsnippet
|
||||
snippet scope "scope (scope)" b
|
||||
scope(${1:exit})
|
||||
{
|
||||
${VISUAL}${2}
|
||||
${VISUAL}$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# With
|
||||
|
||||
snippet with "with (with)"
|
||||
with(${1})
|
||||
with($1)
|
||||
{
|
||||
${VISUAL}${2}
|
||||
${VISUAL}$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -315,7 +315,7 @@ try
|
||||
{
|
||||
${VISUAL}${1:/*code to try*/}
|
||||
}
|
||||
catch(${2}Exception e)
|
||||
catch($2Exception e)
|
||||
{
|
||||
${3:/*handle exception*/}
|
||||
}
|
||||
@ -326,7 +326,7 @@ try
|
||||
{
|
||||
${VISUAL}${1:/*code to try*/}
|
||||
}
|
||||
catch(${2}Exception e)
|
||||
catch($2Exception e)
|
||||
{
|
||||
${3:/*handle exception*/}
|
||||
}
|
||||
@ -337,14 +337,14 @@ finally
|
||||
endsnippet
|
||||
|
||||
snippet catch "catch (catch)" b
|
||||
catch(${1}Exception e)
|
||||
catch($1Exception e)
|
||||
{
|
||||
${2:/*handle exception*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet thr "throw (thr)"
|
||||
throw new ${1}Exception("${2}");
|
||||
throw new $1Exception("$2");
|
||||
endsnippet
|
||||
|
||||
|
||||
@ -353,35 +353,35 @@ endsnippet
|
||||
snippet struct "struct (struct)"
|
||||
struct ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet union "union (union)"
|
||||
union ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet class "class (class)"
|
||||
class ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet inter "interface (inter)"
|
||||
interface ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet enum "enum (enum)"
|
||||
enum ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -390,7 +390,7 @@ endsnippet
|
||||
|
||||
snippet exc "exception declaration (exc)" b
|
||||
/// ${3:/*documentation*/}
|
||||
class ${1}Exception : ${2}Exception
|
||||
class $1Exception : $2Exception
|
||||
{
|
||||
public this(string msg, string file = __FILE__, int line = __LINE__)
|
||||
{
|
||||
@ -405,14 +405,14 @@ endsnippet
|
||||
snippet version "version (version)" b
|
||||
version(${1:/*version name*/})
|
||||
{
|
||||
${VISUAL}${2}
|
||||
${VISUAL}$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet debug "debug" b
|
||||
debug
|
||||
{
|
||||
${VISUAL}${1}
|
||||
${VISUAL}$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -422,7 +422,7 @@ endsnippet
|
||||
snippet temp "template (temp)" b
|
||||
template ${2:/*name*/}(${1:/*args*/})
|
||||
{
|
||||
${3}
|
||||
$3
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -440,7 +440,7 @@ endsnippet
|
||||
snippet unittest "unittest (unittest)" b
|
||||
unittest
|
||||
{
|
||||
${1}
|
||||
$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -450,21 +450,21 @@ endsnippet
|
||||
snippet opDis "opDispatch (opDis)" b
|
||||
${1:/*return type*/} opDispatch(string s)()
|
||||
{
|
||||
${2};
|
||||
$2;
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet op= "opAssign (op=)" b
|
||||
void opAssign(${1} rhs) ${2:@safe pure nothrow}
|
||||
void opAssign($1 rhs) ${2:@safe pure nothrow}
|
||||
{
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet opCmp "opCmp (opCmp)" b
|
||||
int opCmp(${1} rhs) @safe const pure nothrow
|
||||
int opCmp($1 rhs) @safe const pure nothrow
|
||||
{
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -484,7 +484,7 @@ endsnippet
|
||||
snippet toString "toString (toString)" b
|
||||
string toString() @safe const pure nothrow
|
||||
{
|
||||
${1}
|
||||
$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -493,7 +493,7 @@ endsnippet
|
||||
|
||||
|
||||
snippet todo "TODO (todo)"
|
||||
// TODO: ${1}
|
||||
// TODO: $1
|
||||
endsnippet
|
||||
|
||||
|
||||
@ -509,16 +509,16 @@ snippet fdoc "function ddoc block (fdoc)" b
|
||||
/// ${1:description}
|
||||
///
|
||||
/// ${2:Params: ${3:param} = ${4:param description}
|
||||
/// ${5}}
|
||||
/// $5}
|
||||
///
|
||||
/// ${6:Returns: ${7:return value}}
|
||||
///
|
||||
/// ${8:Throws: ${9}Exception ${10}}
|
||||
/// ${8:Throws: $9Exception $10}
|
||||
endsnippet
|
||||
|
||||
snippet Par "Params (Par)"
|
||||
Params: ${1:param} = ${2:param description}
|
||||
/// ${3}
|
||||
/// $3
|
||||
endsnippet
|
||||
|
||||
snippet Ret "Returns (Ret)"
|
||||
@ -526,7 +526,7 @@ Returns: ${1:return value/s}
|
||||
endsnippet
|
||||
|
||||
snippet Thr "Throws (Thr)"
|
||||
Throws: ${1}Exception ${2}
|
||||
Throws: $1Exception $2
|
||||
endsnippet
|
||||
|
||||
snippet Example "Examples (Example)"
|
||||
@ -556,7 +556,7 @@ snippet gpl "GPL (gpl)" b
|
||||
//
|
||||
// Copyright (C) ${1:Author}, `!v strftime("%Y")`
|
||||
|
||||
${2}
|
||||
$2
|
||||
endsnippet
|
||||
|
||||
snippet boost "Boost (boost)" b
|
||||
@ -565,7 +565,7 @@ snippet boost "Boost (boost)" b
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
${2}
|
||||
$2
|
||||
endsnippet
|
||||
|
||||
|
||||
@ -577,8 +577,8 @@ snippet module "New module (module)" b
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
module ${2}.`!v vim_snippets#Filename('$1', 'name')`;
|
||||
module $2.`!v vim_snippets#Filename('$1', 'name')`;
|
||||
|
||||
|
||||
${3}
|
||||
$3
|
||||
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.DecimalField(max_digits=${2:10}, decimal_places=${3: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 $1Admin(admin.ModelAdmin):
|
||||
'''
|
||||
Admin View for $1
|
||||
'''
|
||||
list_display = ('$2',)
|
||||
list_filter = ('$3',)
|
||||
inlines = [
|
||||
$4Inline,
|
||||
]
|
||||
raw_id_fields = ('$5',)
|
||||
readonly_fields = ('$6',)
|
||||
search_fields = ['$7']
|
||||
admin.site.register($1, $1Admin)
|
||||
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 $1Inline(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 $1Inline(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
|
||||
|
39
sources_non_forked/vim-snippets/UltiSnips/eelixir.snippets
Normal file
39
sources_non_forked/vim-snippets/UltiSnips/eelixir.snippets
Normal file
@ -0,0 +1,39 @@
|
||||
priority -50
|
||||
|
||||
extends html
|
||||
|
||||
snippet % "<% %>" w
|
||||
<% $0 %>
|
||||
endsnippet
|
||||
|
||||
snippet = "<%= %>" w
|
||||
<%= $0 %>
|
||||
endsnippet
|
||||
|
||||
snippet end "<% end %>" w
|
||||
<% end %>
|
||||
endsnippet
|
||||
|
||||
snippet for
|
||||
<%= for ${1:item} <- ${2:$1s} ${3:@conn} do %>
|
||||
$0
|
||||
<% end %>
|
||||
endsnippet
|
||||
|
||||
snippet ft "form_tag" w
|
||||
<%= form_tag(${1:"${2:/users}"}, method: ${3::post}) %>
|
||||
$0
|
||||
</form>
|
||||
endsnippet
|
||||
|
||||
snippet lin "link" w
|
||||
<%= link ${1:"${2:Submit}"}, to: ${3:"${4:/users}"}, method: ${5::delete} %>
|
||||
endsnippet
|
||||
|
||||
snippet ff "form_for" w
|
||||
<%= form_for @changeset, ${1:"${2:/users}"}, fn f -> %>
|
||||
$0
|
||||
|
||||
<%= submit "Submit" %>
|
||||
<% end %>
|
||||
endsnippet
|
@ -1,168 +0,0 @@
|
||||
priority -50
|
||||
|
||||
snippet do
|
||||
do
|
||||
${1}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet if "if .. do .. end"
|
||||
if ${1:condition} do
|
||||
${2:expression}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet if "if .. do: .."
|
||||
if ${1:condition}, do: ${2:expression}
|
||||
endsnippet
|
||||
|
||||
snippet ife "if .. do .. else .. end"
|
||||
if ${1:condition} do
|
||||
${2:expression}
|
||||
else
|
||||
${3:expression}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet ife "if .. do: .. else:"
|
||||
if ${1:condition}, do: ${2}, else: ${3}
|
||||
endsnippet
|
||||
|
||||
snippet unless "unless .. do .. end"
|
||||
unless ${1} do
|
||||
${2}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet unless "unless .. do: .."
|
||||
unless ${1:condition}, do: ${2}
|
||||
endsnippet
|
||||
|
||||
snippet unlesse "unless .. do .. else .. end"
|
||||
unless ${1:condition} do
|
||||
${2}
|
||||
else
|
||||
${3}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet unlesse "unless .. do: .. else:"
|
||||
unless ${1:condition}, do: ${2}, else: ${3}
|
||||
endsnippet
|
||||
|
||||
snippet cond
|
||||
"cond do"
|
||||
${1} ->
|
||||
${2}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet case
|
||||
case ${1} do
|
||||
${2} ->
|
||||
${3}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet def
|
||||
def ${1:name} do
|
||||
${2}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet defin "def function(n), do: n"
|
||||
def ${1:name}, do: ${2}
|
||||
endsnippet
|
||||
|
||||
snippet defg
|
||||
def ${1:name} when ${2:guard-condition} do
|
||||
${3}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet defim
|
||||
defimpl ${1:protocol_name}, for: ${2:data_type} do
|
||||
${3}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet defma
|
||||
defmacro ${1:name} do
|
||||
${2}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet defmo
|
||||
defmodule ${1:module_name} do
|
||||
${2}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet defp
|
||||
defp ${1:name} do
|
||||
${2}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet defpr
|
||||
defprotocol ${1:name}, [${2:function}]
|
||||
endsnippet
|
||||
|
||||
snippet defr
|
||||
defrecord ${1:record_name}, ${2:fields}
|
||||
endsnippet
|
||||
|
||||
snippet doc
|
||||
@doc """
|
||||
${1}
|
||||
"""
|
||||
endsnippet
|
||||
|
||||
snippet fn
|
||||
fn(${1:args}) -> ${2} end
|
||||
endsnippet
|
||||
|
||||
snippet fun
|
||||
function do
|
||||
${1}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet mdoc
|
||||
@moduledoc """
|
||||
${1}
|
||||
"""
|
||||
endsnippet
|
||||
|
||||
snippet rec
|
||||
receive do
|
||||
${1} ->
|
||||
${2}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet req
|
||||
require ${1:module_name}
|
||||
endsnippet
|
||||
|
||||
snippet imp
|
||||
import ${1:module_name}
|
||||
endsnippet
|
||||
|
||||
snippet ali "alias old-module to shorthand"
|
||||
alias ${1:module_name}
|
||||
endsnippet
|
||||
|
||||
snippet test
|
||||
test "${1:test_name}" do
|
||||
${2}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet try "try .. rescue .. end"
|
||||
try do
|
||||
${1}
|
||||
rescue
|
||||
${2} -> ${3}
|
||||
end
|
||||
endsnippet
|
@ -5,12 +5,12 @@
|
||||
priority -50
|
||||
|
||||
snippet pat "Case:Receive:Try Clause"
|
||||
${1:pattern}${2: when ${3:guard}} ->;
|
||||
${1:pattern}${2: when ${3:guard}} ->
|
||||
${4:body}
|
||||
endsnippet
|
||||
|
||||
snippet beh "Behaviour Directive"
|
||||
-behaviour (${1:behaviour}).
|
||||
snippet beh "Behaviour Directive" b
|
||||
-behaviour(${1:behaviour}).
|
||||
endsnippet
|
||||
|
||||
snippet case "Case Expression"
|
||||
@ -20,12 +20,12 @@ case ${1:expression} of
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet def "Define Directive"
|
||||
-define (${1:macro}${2: (${3:param})}, ${4:body}).
|
||||
snippet def "Define Directive" b
|
||||
-define(${1:macro}${2: (${3:param})}, ${4:body}).
|
||||
endsnippet
|
||||
|
||||
snippet exp "Export Directive"
|
||||
-export ([${1:function}/${2:arity}]).
|
||||
snippet exp "Export Directive" b
|
||||
-export([${1:function}/${2:arity}]).
|
||||
endsnippet
|
||||
|
||||
snippet fun "Fun Expression"
|
||||
@ -36,7 +36,7 @@ end
|
||||
endsnippet
|
||||
|
||||
snippet fu "Function"
|
||||
${1:function} (${2:param})${3: when ${4:guard}} ->
|
||||
${1:function}(${2:param})${3: when ${4:guard}} ->
|
||||
${5:body}
|
||||
endsnippet
|
||||
|
||||
@ -47,24 +47,24 @@ if
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet ifdef "Ifdef Directive"
|
||||
-ifdef (${1:macro}).
|
||||
snippet ifdef "Ifdef Directive" b
|
||||
-ifdef(${1:macro}).
|
||||
endsnippet
|
||||
|
||||
snippet ifndef "Ifndef Directive"
|
||||
-ifndef (${1:macro}).
|
||||
snippet ifndef "Ifndef Directive" b
|
||||
-ifndef(${1:macro}).
|
||||
endsnippet
|
||||
|
||||
snippet imp "Import Directive"
|
||||
-import (${1:module}, [${2:function}/${3:arity}]).
|
||||
snippet imp "Import Directive" b
|
||||
-import(${1:module}, [${2:function}/${3:arity}]).
|
||||
endsnippet
|
||||
|
||||
snippet inc "Include Directive"
|
||||
-include ("${1:file}").
|
||||
snippet inc "Include Directive" b
|
||||
-include("${1:file}").
|
||||
endsnippet
|
||||
|
||||
snippet mod "Module Directive"
|
||||
-module (${1:`!p snip.rv = snip.basename or "module"`}).
|
||||
snippet mod "Module Directive" b
|
||||
-module(${1:`!p snip.rv = snip.basename or "module"`}).
|
||||
endsnippet
|
||||
|
||||
snippet rcv "Receive Expression"
|
||||
@ -77,8 +77,8 @@ ${6:after
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet rec "Record Directive"
|
||||
-record (${1:record}, {${2:field}${3: = ${4:value}}}).
|
||||
snippet rec "Record Directive" b
|
||||
-record(${1:record}, {${2:field}${3: = ${4:value}}}).
|
||||
endsnippet
|
||||
|
||||
snippet try "Try Expression"
|
||||
@ -93,8 +93,16 @@ ${13:after
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet undef "Undef Directive"
|
||||
-undef (${1:macro}).
|
||||
snippet undef "Undef Directive" b
|
||||
-undef(${1:macro}).
|
||||
endsnippet
|
||||
|
||||
snippet || "List Comprehension"
|
||||
[${1:X} || ${2:X} <- ${3:List}${4:, gen}]
|
||||
endsnippet
|
||||
|
||||
snippet gen "Generator Expression"
|
||||
${1:X} <- ${2:List}${3:, gen}
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -27,12 +27,12 @@ def textmate_var(var, snip):
|
||||
endglobal
|
||||
|
||||
|
||||
snippet % "<% ${0} %>"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`${0}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)`
|
||||
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} %>"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`${0}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
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,112 +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 end "end (ERB)"
|
||||
<% end -%>
|
||||
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 for "for loop (ERB)"
|
||||
<% if !${1:list}.blank? %>
|
||||
<% for ${2:item} in ${1} %>
|
||||
$3
|
||||
<% end %>
|
||||
<% else %>
|
||||
$4
|
||||
<% end %>
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet ffcb "form_for check_box"
|
||||
`!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 ffff "form_for file_field 2"
|
||||
`!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 ffhf "form_for hidden_field 2"
|
||||
`!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 ffl "form_for label 2"
|
||||
`!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 ffpf "form_for password_field 2"
|
||||
`!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 ffrb "form_for radio_box 2"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.radio_box :${1:attribute}, :${2:tag_value}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet ffs "form_for submit 2"
|
||||
`!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 ffta "form_for text_area 2"
|
||||
`!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 fftf "form_for text_field 2"
|
||||
`!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 fields "fields_for"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`fields_for :${1:model}, @${2:$1} do |$1|`!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_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_box"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.radio_box :${1:attribute}, :${2:tag_value}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
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)`
|
||||
@ -156,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
|
||||
|
||||
@ -174,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)"
|
||||
`!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)`
|
||||
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)"
|
||||
`!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)`
|
||||
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)"
|
||||
`!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)`
|
||||
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
|
||||
|
||||
@ -266,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
|
||||
|
||||
@ -279,10 +230,6 @@ snippet else "else (ERB)"
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet if "if (ERB)"
|
||||
<% if ${1:condition} %>$0
|
||||
endsnippet
|
||||
|
||||
snippet lf "link_to_function"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to_function ${1:"${2:Greeting}"}, "${3:alert('Hello world!')}"$4`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
@ -45,25 +45,6 @@ type ${1:Interface} interface {
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# statements
|
||||
snippet for "For loop" b
|
||||
for ${1:condition}${1/(.+)/ /}{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fori "Integer for loop" b
|
||||
for ${1:i} := 0; $1 < ${2:N}; $1++ {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet forr "For range loop" b
|
||||
for ${2:name} := range ${1:collection} {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet if "If statement" b
|
||||
if ${1:condition}${1/(.+)/ /}{
|
||||
${0:${VISUAL}}
|
||||
@ -72,26 +53,10 @@ endsnippet
|
||||
|
||||
snippet switch "Switch statement" b
|
||||
switch ${1:expression}${1/(.+)/ /}{
|
||||
case${0}
|
||||
case$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet select "Select statement" b
|
||||
select {
|
||||
case${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet case "Case clause" b
|
||||
case ${1:condition}:
|
||||
${0:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet default "Default clause" b
|
||||
default:
|
||||
${0:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
# functions
|
||||
snippet /^main/ "Main function" r
|
||||
func main() {
|
||||
@ -111,6 +76,12 @@ func ${1:name}(${2:params})${3/(.+)/ /}${3:type} {
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet funch "HTTP handler" b
|
||||
func ${1:handler}(${2:w} http.ResponseWriter, ${3:r} *http.Request) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# types and variables
|
||||
snippet map "Map type" b
|
||||
map[${1:keytype}]${2:valtype}
|
||||
@ -135,3 +106,10 @@ snippet json "JSON field"
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
||||
# error handling
|
||||
snippet err "Basic error handling" b
|
||||
if err != nil {
|
||||
log.${1:Fatal}(err)
|
||||
}
|
||||
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
|
@ -12,33 +12,6 @@ def x(snip):
|
||||
snip.rv = ""
|
||||
endglobal
|
||||
|
||||
############
|
||||
# Doctypes #
|
||||
############
|
||||
snippet doctype "DocType XHTML 1.0 Strict" b
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet doctype "DocType XHTML 1.0 Transitional" b
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet doctype "DocType XHTML 1.1" b
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet doctype "HTML - 4.0 Transitional (doctype)" b
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet doctype "HTML - 5.0 (doctype)" b
|
||||
<!DOCTYPE html>
|
||||
|
||||
@ -83,100 +56,62 @@ snippet left "Left (left)"
|
||||
←
|
||||
endsnippet
|
||||
|
||||
snippet option "Option (option)"
|
||||
⌥
|
||||
endsnippet
|
||||
|
||||
#######################
|
||||
# Conditional inserts #
|
||||
#######################
|
||||
snippet ! "IE Conditional Comment: Internet Explorer 5_0 only"
|
||||
<!--[if IE 5.0]>${1:IE Conditional Comment: Internet Explorer 5.0 only }<![endif]-->$0
|
||||
endsnippet
|
||||
|
||||
snippet ! "IE Conditional Comment: Internet Explorer 5_5 only"
|
||||
<!--[if IE 5.5000]>${1:IE Conditional Comment: Internet Explorer 5.5 only }<![endif]-->$0
|
||||
endsnippet
|
||||
|
||||
snippet ! "IE Conditional Comment: Internet Explorer 5_x"
|
||||
<!--[if lt IE 6]>${1:IE Conditional Comment: Internet Explorer 5.x }<![endif]-->$0
|
||||
endsnippet
|
||||
|
||||
snippet ! "IE Conditional Comment: Internet Explorer 6 and below"
|
||||
<!--[if lte IE 6]>${1:IE Conditional Comment: Internet Explorer 6 and below }<![endif]-->$0
|
||||
endsnippet
|
||||
|
||||
snippet ! "IE Conditional Comment: Internet Explorer 6 only"
|
||||
<!--[if IE 6]>${1:IE Conditional Comment: Internet Explorer 6 only }<![endif]-->$0
|
||||
endsnippet
|
||||
|
||||
snippet ! "IE Conditional Comment: Internet Explorer 7+"
|
||||
<!--[if gte IE 7]>${1:IE Conditional Comment: Internet Explorer 7 and above }<![endif]-->$0
|
||||
endsnippet
|
||||
|
||||
snippet ! "IE Conditional Comment: Internet Explorer"
|
||||
<!--[if IE]>${1: IE Conditional Comment: Internet Explorer }<![endif]-->$0
|
||||
endsnippet
|
||||
|
||||
snippet ! "IE Conditional Comment: NOT Internet Explorer"
|
||||
<!--[if !IE]><!-->${1: IE Conditional Comment: NOT Internet Explorer }<!-- <![endif]-->$0
|
||||
endsnippet
|
||||
|
||||
#############
|
||||
# HTML TAGS #
|
||||
#############
|
||||
snippet input "Input with Label" w
|
||||
<label for="${2:${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}}">$1</label><input type="${3:text/submit/hidden/button}" name="${4:$2}" value="$5"${6: id="${7:$2}"}`!p x(snip)`>
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet input "XHTML <input>" w
|
||||
snippet input "HTML <input>" w
|
||||
<input type="${1:text/submit/hidden/button}" name="${2:some_name}" value="$3"${4: id="${5:$2}"}`!p x(snip)`>
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet opt "Option" w
|
||||
snippet option "Option" w
|
||||
<option${1: value="${2:option}"}>${3:$2}</option>
|
||||
endsnippet
|
||||
|
||||
snippet select "Select Box" w
|
||||
<select name="${1:some_name}" id="${2:$1}"${3:${4: multiple}${5: onchange="${6:}"}${7: size="${8:1}"}}>
|
||||
<option${9: value="${10:option1}"}>${11:$10}</option>
|
||||
<option${12: value="${13:option2}"}>${14:$13}</option>${15:}
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
</select>
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet textarea "XHTML <textarea>" w
|
||||
snippet textarea "HTML <textarea>" w
|
||||
<textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">$0</textarea>
|
||||
endsnippet
|
||||
|
||||
snippet mailto "XHTML <a mailto: >" w
|
||||
snippet mailto "HTML <a mailto: >" w
|
||||
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>
|
||||
endsnippet
|
||||
|
||||
snippet base "XHTML <base>" w
|
||||
snippet base "HTML <base>" w
|
||||
<base href="$1"${2: target="$3"}`!p x(snip)`>
|
||||
endsnippet
|
||||
|
||||
snippet body "XHTML <body>"
|
||||
<body id="${1:`!p
|
||||
snip.rv = snip.fn and 'Hallo' or 'Nothin'
|
||||
`}"${2: onload="$3"}>
|
||||
$0
|
||||
snippet body "<body>"
|
||||
<body>
|
||||
${0:${VISUAL}}
|
||||
</body>
|
||||
endsnippet
|
||||
|
||||
snippet div "<div>" w
|
||||
<div>
|
||||
${0:${VISUAL}}
|
||||
</div>
|
||||
endsnippet
|
||||
|
||||
snippet div. "<div> with class" w
|
||||
<div`!p snip.rv=' class="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`>
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
</div>
|
||||
endsnippet
|
||||
|
||||
snippet div# "<div> with ID & class" w
|
||||
<div`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""``!p snip.rv=' class="' if t[2] else ""`${2:name}`!p snip.rv = '"' if t[2] else ""`>
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
</div>
|
||||
endsnippet
|
||||
|
||||
@ -184,21 +119,39 @@ snippet form "XHTML <form>" w
|
||||
<form action="${1:`!p
|
||||
snip.rv = (snip.basename or 'unnamed') + '_submit'
|
||||
`}" method="${2:get}" accept-charset="utf-8">
|
||||
$0
|
||||
|
||||
<p><input type="submit" value="Continue →"`!p x(snip)`></p>
|
||||
${0:${VISUAL}}
|
||||
</form>
|
||||
endsnippet
|
||||
|
||||
snippet h1 "XHTML <h1>" w
|
||||
<h1 id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}">${1}</h1>
|
||||
<h1>${0:${VISUAL}}</h1>
|
||||
endsnippet
|
||||
|
||||
snippet h2 "XHTML <h2>" w
|
||||
<h2>${0:${VISUAL}}</h2>
|
||||
endsnippet
|
||||
|
||||
snippet h3 "XHTML <h3>" w
|
||||
<h3>${0:${VISUAL}}</h3>
|
||||
endsnippet
|
||||
|
||||
snippet h4 "XHTML <h4>" w
|
||||
<h4>${0:${VISUAL}}</h4>
|
||||
endsnippet
|
||||
|
||||
snippet h5 "XHTML <h5>" w
|
||||
<h5>${0:${VISUAL}}</h5>
|
||||
endsnippet
|
||||
|
||||
snippet h6 "XHTML <h6>" w
|
||||
<h6>${0:${VISUAL}}</h6>
|
||||
endsnippet
|
||||
|
||||
snippet head "XHTML <head>"
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
</head>
|
||||
endsnippet
|
||||
|
||||
@ -210,26 +163,37 @@ snippet meta "XHTML <meta>" w
|
||||
<meta name="${1:name}" content="${2:content}"`!p x(snip)`>
|
||||
endsnippet
|
||||
|
||||
snippet scriptsrc "XHTML <script src...>" w
|
||||
<script src="$1" type="text/javascript" charset="${3:utf-8}"></script>
|
||||
snippet scriptsrc "HTML <script src...>" w
|
||||
<script src="$1" charset="${3:utf-8}"></script>
|
||||
endsnippet
|
||||
|
||||
snippet script "XHTML <script>" w
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$0
|
||||
snippet script "HTML <script>" w
|
||||
<script charset="utf-8">
|
||||
${0:${VISUAL}}
|
||||
</script>
|
||||
endsnippet
|
||||
|
||||
snippet span "<span>" w
|
||||
<span> ${0:${VISUAL}} </span>
|
||||
endsnippet
|
||||
|
||||
snippet span. "<span> with class" w
|
||||
<span`!p snip.rv=' class="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`> ${0:${VISUAL}} </span>
|
||||
endsnippet
|
||||
|
||||
snippet span# "<span> with ID & class" w
|
||||
<span`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""``!p snip.rv=' class="' if t[2] else ""`${2:name}`!p snip.rv = '"' if t[2] else ""`> ${0:${VISUAL}} </span>
|
||||
endsnippet
|
||||
|
||||
snippet style "XHTML <style>" w
|
||||
<style type="text/css" media="screen">
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
</style>
|
||||
endsnippet
|
||||
|
||||
snippet table "XHTML <table>" w
|
||||
<table border="${1:0}"${2: cellspacing="${3:5}" cellpadding="${4:5}"}>
|
||||
<tr><th>${5:Header}</th></tr>
|
||||
<tr><td>${0:Data}</td></tr>
|
||||
<table>
|
||||
${0:${VISUAL}}
|
||||
</table>
|
||||
endsnippet
|
||||
|
||||
@ -238,29 +202,29 @@ snippet a "Link" w
|
||||
endsnippet
|
||||
|
||||
snippet p "paragraph" w
|
||||
<p>$0</p>
|
||||
<p>${0:${VISUAL}}</p>
|
||||
endsnippet
|
||||
|
||||
snippet li "list item" w
|
||||
<li>$0</li>
|
||||
<li>${0:${VISUAL}}</li>
|
||||
endsnippet
|
||||
|
||||
snippet ul "unordered list" w
|
||||
<ul>
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
</ul>
|
||||
endsnippet
|
||||
|
||||
snippet td "table cell" w
|
||||
<td>$0</td>
|
||||
<td>${0:${VISUAL}}</td>
|
||||
endsnippet
|
||||
|
||||
snippet th "table header" w
|
||||
<th>$0</th>
|
||||
<th>${0:${VISUAL}}</th>
|
||||
endsnippet
|
||||
|
||||
snippet tr "table row" w
|
||||
<tr>$0</tr>
|
||||
<tr>${0:${VISUAL}}</tr>
|
||||
endsnippet
|
||||
|
||||
snippet title "XHTML <title>" w
|
||||
@ -270,39 +234,11 @@ endsnippet
|
||||
snippet fieldset "Fieldset" w
|
||||
<fieldset id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}" ${2:class="${3:}"}>
|
||||
<legend>$1</legend>
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
</fieldset>
|
||||
endsnippet
|
||||
|
||||
snippet movie "Embed QT movie (movie)" b
|
||||
<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"`!p x(snip)`>
|
||||
<param name="controller" value="$4"`!p x(snip)`>
|
||||
<param name="autoplay" value="$5"`!p x(snip)`>
|
||||
<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/"
|
||||
`!p x(snip)`>
|
||||
</object>
|
||||
endsnippet
|
||||
|
||||
snippet html5 "HTML5 Template"
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>${1}</title>
|
||||
<meta charset="utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
${2}
|
||||
</header>
|
||||
<footer>
|
||||
${4}
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
snippet viewport "Responsive viewport meta" w
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
endsnippet
|
||||
# vim:ft=snippets:
|
||||
|
@ -4,24 +4,24 @@
|
||||
priority -50
|
||||
|
||||
snippet id
|
||||
id="${1}"${2}
|
||||
id="$1"$2
|
||||
endsnippet
|
||||
|
||||
snippet idn
|
||||
id="${1}" name="${2:$1}"
|
||||
id="$1" name="${2:$1}"
|
||||
endsnippet
|
||||
|
||||
snippet label_and_input
|
||||
<label for="${2:$1}">${1}</label>
|
||||
<input type="${3:text}" name="${4:$2}"${5: id="${6:$2}"} value="${7}" />${8}
|
||||
<label for="${2:$1}">$1</label>
|
||||
<input type="${3:text}" name="${4:$2}"${5: id="${6:$2}"} value="$7" />$8
|
||||
endsnippet
|
||||
|
||||
snippet input
|
||||
<input type="${1:text}" value="${2}" name="${3}"${4: id="${5:$3}}/>${7}
|
||||
<input type="${1:text}" value="$2" name="$3"${4: id="${5:$3}"}/>$7
|
||||
endsnippet
|
||||
|
||||
snippet submit
|
||||
<input type="submit" value="${2}" ${3}/>${7}
|
||||
<input type="submit" value="$2" $3/>$7
|
||||
endsnippet
|
||||
|
||||
snippet textarea
|
||||
@ -29,5 +29,5 @@ snippet textarea
|
||||
endsnippet
|
||||
|
||||
snippet img
|
||||
<img src="$1"${2: alt="$3"}/>
|
||||
<img src="$1"${2: alt="$3"}/>
|
||||
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 csrf "" 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:
|
||||
|
@ -21,7 +21,7 @@ def nl(snip):
|
||||
snip.rv += " "
|
||||
def getArgs(group):
|
||||
import re
|
||||
word = re.compile('[a-zA-Z><.]+ \w+')
|
||||
word = re.compile('[a-zA-Z0-9><.]+ \w+')
|
||||
return [i.split(" ") for i in word.findall(group) ]
|
||||
|
||||
def camel(word):
|
||||
@ -48,7 +48,7 @@ $0
|
||||
endsnippet
|
||||
|
||||
snippet /o|v/ "new Object or variable" br
|
||||
${1:Object} ${2:var} = new $1(${3});
|
||||
${1:Object} ${2:var} = new $1($3);
|
||||
endsnippet
|
||||
|
||||
snippet f "field" b
|
||||
@ -109,7 +109,7 @@ for i in args:
|
||||
snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";"
|
||||
if len(args) > 0:
|
||||
snip.rv += "\n"`
|
||||
public `!p snip.rv = snip.basename or "unknown"`($1) { `!p
|
||||
public `!p snip.rv = snip.basename or "unknown"`($1) {`!p
|
||||
args = getArgs(t[1])
|
||||
for i in args:
|
||||
snip.rv += "\n\t\tthis." + i[1] + " = " + i[1] + ";"
|
||||
@ -123,8 +123,8 @@ for i in args:
|
||||
snip.rv += "\n\tpublic void set" + camel(i[1]) + "(" + i[0] + " " + i[1] + ") {\n" + "\
|
||||
\tthis." + i[1] + " = " + i[1] + ";\n\t}\n"
|
||||
|
||||
snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\
|
||||
\n\t\treturn " + i[1] + ";\n\t}\n"
|
||||
snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\n\
|
||||
\treturn " + i[1] + ";\n\t}\n"
|
||||
`
|
||||
}
|
||||
endsnippet
|
||||
@ -138,7 +138,7 @@ for i in args:
|
||||
snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";"
|
||||
if len(args) > 0:
|
||||
snip.rv += "\n"`
|
||||
public `!p snip.rv = snip.basename or "unknown"`($1) { `!p
|
||||
public `!p snip.rv = snip.basename or "unknown"`($1) {`!p
|
||||
args = getArgs(t[1])
|
||||
for i in args:
|
||||
snip.rv += "\n\t\tthis.%s = %s;" % (i[1], i[1])
|
||||
@ -266,7 +266,7 @@ for i in args:
|
||||
snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";"
|
||||
if len(args) > 0:
|
||||
snip.rv += "\n"`
|
||||
public `!p snip.rv = snip.basename or "unknown"`($1) { `!p
|
||||
public `!p snip.rv = snip.basename or "unknown"`($1) {`!p
|
||||
args = getArgs(t[1])
|
||||
for i in args:
|
||||
snip.rv += "\n\t\tthis.%s = %s;" % (i[1], i[1])
|
||||
@ -310,13 +310,13 @@ try {
|
||||
endsnippet
|
||||
|
||||
snippet mt "method throws" b
|
||||
${1:private} ${2:void} ${3:method}(${4}) ${5:throws $6 }{
|
||||
${1:private} ${2:void} ${3:method}($4) ${5:throws $6 }{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet m "method" b
|
||||
${1:private} ${2:void} ${3:method}(${4}) {
|
||||
${1:private} ${2:void} ${3:method}($4) {
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
@ -326,11 +326,11 @@ snippet md "Method With javadoc" b
|
||||
* ${7:Short Description}`!p
|
||||
for i in getArgs(t[4]):
|
||||
snip.rv += "\n\t * @param " + i[1] + " usage..."`
|
||||
* `!p
|
||||
*`!p
|
||||
if "throws" in t[5]:
|
||||
snip.rv = "\n\t * @throws " + t[6]
|
||||
else:
|
||||
snip.rv = ""` `!p
|
||||
snip.rv = ""``!p
|
||||
if not "void" in t[2]:
|
||||
snip.rv = "\n\t * @return object"
|
||||
else:
|
||||
@ -356,8 +356,7 @@ endsnippet
|
||||
snippet /se?tge?t|ge?tse?t|gs/ "setter and getter" br
|
||||
public void set${1:Name}(${2:String} `!p snip.rv = mixedCase(t[1])`) {
|
||||
this.`!p snip.rv = mixedCase(t[1])` = `!p snip.rv = mixedCase(t[1])`;
|
||||
}
|
||||
|
||||
}`!p snip.rv += "\n"`
|
||||
public $2 get$1() {
|
||||
return `!p snip.rv = mixedCase(t[1])`;
|
||||
}
|
||||
|
@ -0,0 +1,77 @@
|
||||
priority -50
|
||||
|
||||
snippet iti "it (js, inject)" b
|
||||
it('${1:description}', inject(function($2) {
|
||||
$0
|
||||
}));
|
||||
endsnippet
|
||||
|
||||
snippet befi "before each (js, inject)" b
|
||||
beforeEach(inject(function($1) {
|
||||
$0
|
||||
}));
|
||||
endsnippet
|
||||
|
||||
snippet aconf "angular config" i
|
||||
config(function($1) {
|
||||
$0
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet acont "angular controller" i
|
||||
controller('${1:name}', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet aconts "angular controller with scope" i
|
||||
controller('${1:name}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet adir "angular directive" i
|
||||
directive('$1', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||
return {
|
||||
restrict: '${3:EA}',
|
||||
link: function(scope, element, attrs) {
|
||||
$0
|
||||
}
|
||||
};
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet adirs "angular directive with scope" i
|
||||
directive('$1', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||
return {
|
||||
restrict: '${3:EA}',
|
||||
link: function(scope, element, attrs) {
|
||||
$0
|
||||
}
|
||||
};
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet afact "angular factory" i
|
||||
factory('${1:name}', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet afacts "angular factory with scope" i
|
||||
factory('${1:name}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet aserv "angular service" i
|
||||
service('${1:name}', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet aservs "angular service" i
|
||||
service('${1:name}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
@ -0,0 +1,234 @@
|
||||
priority -50
|
||||
|
||||
# JavaScript versions -- from the TextMate bundle + some additions
|
||||
# for jasmine-jquery matchers
|
||||
#
|
||||
|
||||
snippet des "Describe (js)" b
|
||||
describe('${1:description}', () => {
|
||||
$0
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet it "it (js)" b
|
||||
it('${1:description}', () => {
|
||||
$0
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet bef "before each (js)" b
|
||||
beforeEach(() => {
|
||||
$0
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet aft "after each (js)" b
|
||||
afterEach(() => {
|
||||
$0
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet befa "before all (js)" b
|
||||
beforeAll(() => {
|
||||
$0
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet afta "after all (js)" b
|
||||
afterAll(() => {
|
||||
$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(() => {
|
||||
$0
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet wa "waits (js)" b
|
||||
waits($1);
|
||||
endsnippet
|
||||
|
||||
snippet ex "expect (js)" b
|
||||
expect(${1:target})$0;
|
||||
endsnippet
|
||||
|
||||
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
|
||||
|
||||
snippet em "expect to match (js)" b
|
||||
expect(${1:target}).toMatch(${2:pattern});
|
||||
endsnippet
|
||||
|
||||
snippet eha "expect to have attribute (js)" b
|
||||
expect(${1:target}).toHaveAttr('${2:attr}'${3:, '${4:value}'});
|
||||
endsnippet
|
||||
|
||||
snippet et "expect to be truthy (js)" b
|
||||
expect(${1:target}).toBeTruthy();
|
||||
endsnippet
|
||||
|
||||
snippet ef "expect to be falsy (js)" b
|
||||
expect(${1:target}).toBeFalsy();
|
||||
endsnippet
|
||||
|
||||
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
|
||||
|
||||
snippet ec "expect to contain (js)" b
|
||||
expect(${1:target}).toContain(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet ev "expect to be visible (js)" b
|
||||
expect(${1:target}).toBeVisible();
|
||||
endsnippet
|
||||
|
||||
snippet eh "expect to be hidden (js)" b
|
||||
expect(${1:target}).toBeHidden();
|
||||
endsnippet
|
||||
|
||||
snippet eth "expect to throw (js)" b
|
||||
expect(${1:target}).toThrow(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet ethe "expect to throw error (js)" b
|
||||
expect(${1:target}).toThrowError(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notx "expect not (js)" b
|
||||
expect(${1:target}).not$0;
|
||||
endsnippet
|
||||
|
||||
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
|
||||
|
||||
snippet notha "expect to not have attribute (js)" b
|
||||
expect(${1:target}).not.toHaveAttr('${2:attr}'${3:, '${4:value}'});
|
||||
endsnippet
|
||||
|
||||
snippet nott "expect not to be truthy (js)" b
|
||||
expect(${1:target}).not.toBeTruthy();
|
||||
endsnippet
|
||||
|
||||
snippet notf "expect not to be falsy (js)" b
|
||||
expect(${1:target}).not.toBeFalsy();
|
||||
endsnippet
|
||||
|
||||
snippet notd "expect not to be defined (js)" b
|
||||
expect(${1:target}).not.toBeDefined();
|
||||
endsnippet
|
||||
|
||||
snippet notn "expect not to be null (js)" b
|
||||
expect(${1:target}).not.toBeNull();
|
||||
endsnippet
|
||||
|
||||
snippet notc "expect not to contain (js)" b
|
||||
expect(${1:target}).not.toContain(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notv "expect not to be visible (js)" b
|
||||
expect(${1:target}).not.toBeVisible();
|
||||
endsnippet
|
||||
|
||||
snippet noth "expect not to be hidden (js)" b
|
||||
expect(${1:target}).not.toBeHidden();
|
||||
endsnippet
|
||||
|
||||
snippet notth "expect not to throw (js)" b
|
||||
expect(${1:target}).not.toThrow(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notthe "expect not to throw error (js)" b
|
||||
expect(${1:target}).not.toThrowError(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet s "spy on (js)" b
|
||||
spyOn(${1:object}, '${2:method}')$0;
|
||||
endsnippet
|
||||
|
||||
snippet sr "spy on and return (js)" b
|
||||
spyOn(${1:object}, '${2:method}').and.returnValue(${3:arguments});
|
||||
endsnippet
|
||||
|
||||
snippet st "spy on and throw (js)" b
|
||||
spyOn(${1:object}, '${2:method}').and.throwError(${3:exception});
|
||||
endsnippet
|
||||
|
||||
snippet sct "spy on and call through (js)" b
|
||||
spyOn(${1:object}, '${2:method}').and.callThrough();
|
||||
endsnippet
|
||||
|
||||
snippet scf "spy on and call fake (js)" b
|
||||
spyOn(${1:object}, '${2:method}').and.callFake(${3:function});
|
||||
endsnippet
|
||||
|
||||
snippet ethbc "expect to have been called (js)" b
|
||||
expect(${1:target}).toHaveBeenCalled();
|
||||
endsnippet
|
||||
|
||||
snippet nthbc "expect not to have been called (js)" b
|
||||
expect(${1:target}).not.toHaveBeenCalled();
|
||||
endsnippet
|
||||
|
||||
snippet ethbcw "expect to have been called with (js)" b
|
||||
expect(${1:target}).toHaveBeenCalledWith(${2:arguments});
|
||||
endsnippet
|
||||
|
@ -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
|
||||
@ -90,6 +132,14 @@ snippet eh "expect to be hidden (js)" b
|
||||
expect(${1:target}).toBeHidden();
|
||||
endsnippet
|
||||
|
||||
snippet eth "expect to throw (js)" b
|
||||
expect(${1:target}).toThrow(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet ethe "expect to throw error (js)" b
|
||||
expect(${1:target}).toThrowError(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notx "expect not (js)" b
|
||||
expect(${1:target}).not$0;
|
||||
endsnippet
|
||||
@ -98,6 +148,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
|
||||
@ -134,40 +192,32 @@ snippet noth "expect not to be hidden (js)" b
|
||||
expect(${1:target}).not.toBeHidden();
|
||||
endsnippet
|
||||
|
||||
snippet notth "expect not to throw (js)" b
|
||||
expect(${1:target}).not.toThrow(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notthe "expect not to throw error (js)" b
|
||||
expect(${1:target}).not.toThrowError(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet s "spy on (js)" b
|
||||
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"
|
||||
});
|
@ -1,5 +1,19 @@
|
||||
priority -50
|
||||
|
||||
############
|
||||
# COMMON #
|
||||
############
|
||||
|
||||
# The smart snippets use a global options called
|
||||
# "g:ultisnips_javascript.{option}" which can control the format
|
||||
# of trailing semicolon, space before function paren, etc.
|
||||
|
||||
global !p
|
||||
from javascript_snippets import (
|
||||
semi, space_before_function_paren, keyword_spacing
|
||||
)
|
||||
endglobal
|
||||
|
||||
###########################################################################
|
||||
# TextMate Snippets #
|
||||
###########################################################################
|
||||
@ -8,13 +22,13 @@ getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}('$2')
|
||||
endsnippet
|
||||
|
||||
snippet '':f "object method string"
|
||||
'${1:${2:#thing}:${3:click}}': function(element) {
|
||||
'${1:${2:#thing}:${3:click}}': function`!p snip.rv = space_before_function_paren(snip)`(element) {
|
||||
${VISUAL}$0
|
||||
}${10:,}
|
||||
endsnippet
|
||||
|
||||
snippet :f "Object Method"
|
||||
${1:method_name}: function(${3:attribute}) {
|
||||
${1:method_name}: function`!p snip.rv = space_before_function_paren(snip)`(${3:attribute}) {
|
||||
${VISUAL}$0
|
||||
}${10:,}
|
||||
endsnippet
|
||||
@ -28,147 +42,99 @@ ${1:key}: ${2:"${3:value}"}${4:, }
|
||||
endsnippet
|
||||
|
||||
snippet proto "Prototype (proto)"
|
||||
${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {
|
||||
${1:class_name}.prototype.${2:method_name} = function`!p snip.rv = space_before_function_paren(snip)`(${3:first_argument}) {
|
||||
${VISUAL}$0
|
||||
};
|
||||
}`!p snip.rv = semi(snip)`
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet for "for (...) {...} (counting up)" b
|
||||
for (var ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) {
|
||||
snippet fun "function (fun)" w
|
||||
function ${1:function_name}`!p snip.rv = space_before_function_paren(snip)`(${2:argument}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ford "for (...) {...} (counting down, faster)" b
|
||||
for (var ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) {
|
||||
snippet vf "Function assigned to var"
|
||||
${1:var }${2:function_name} = function $2`!p snip.rv = space_before_function_paren(snip)`($3) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
}`!p snip.rv = semi(snip)`
|
||||
endsnippet
|
||||
|
||||
snippet fun "function (fun)"
|
||||
function ${1:function_name}(${2:argument}) {
|
||||
snippet af "Anonymous Function" i
|
||||
function`!p snip.rv = space_before_function_paren(snip)`($1) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet iife "Immediately-Invoked Function Expression (iife)"
|
||||
(function (${1:argument}) {
|
||||
(function`!p snip.rv = space_before_function_paren(snip)`(${1:window}) {
|
||||
${VISUAL}$0
|
||||
}(${2:$1}));
|
||||
}(${2:$1}))`!p snip.rv = semi(snip)`
|
||||
endsnippet
|
||||
|
||||
snippet ife "if ___ else"
|
||||
if (${1:condition}) {
|
||||
${2://code}
|
||||
}
|
||||
else {
|
||||
${3://code}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet if "if"
|
||||
if (${1:condition}) {
|
||||
snippet ;fe "Minify safe iife"
|
||||
;(function`!p snip.rv = space_before_function_paren(snip)`(${1}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
}(${2}))
|
||||
endsnippet
|
||||
|
||||
snippet timeout "setTimeout function"
|
||||
setTimeout(function() {
|
||||
setTimeout(function`!p snip.rv = space_before_function_paren(snip)`() {
|
||||
${VISUAL}$0
|
||||
}${2:.bind(${3:this})}, ${1:10});
|
||||
}${2:.bind(${3:this})}, ${1:10})`!p snip.rv = semi(snip)`
|
||||
endsnippet
|
||||
|
||||
snippet fi "for prop in obj using hasOwnProperty" b
|
||||
for (${1:prop} in ${2:obj}){
|
||||
if ($2.hasOwnProperty($1)) {
|
||||
for`!p snip.rv = keyword_spacing(snip)`(${1:prop} in ${2:obj}){
|
||||
if`!p snip.rv = keyword_spacing(snip)`($2.hasOwnProperty($1)) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# Snippets for Console Debug Output
|
||||
|
||||
snippet ca "console.assert" b
|
||||
console.assert(${1:assertion}, ${2:"${3:message}"});
|
||||
snippet if "if (condition) { ... }"
|
||||
if`!p snip.rv = keyword_spacing(snip)`(${1:true}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cclear "console.clear" b
|
||||
console.clear();
|
||||
snippet ife "if (condition) { ... } else { ... }"
|
||||
if`!p snip.rv = keyword_spacing(snip)`(${1:true}) {
|
||||
${VISUAL}$0
|
||||
}`!p snip.rv = keyword_spacing(snip)`else`!p snip.rv = keyword_spacing(snip)`{
|
||||
${2}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cdir "console.dir" b
|
||||
console.dir(${1:object});
|
||||
snippet switch
|
||||
switch`!p snip.rv = keyword_spacing(snip)`(${VISUAL}${1:expression}) {
|
||||
case '${VISUAL}${3:case}':
|
||||
${4}
|
||||
break`!p snip.rv = semi(snip)`
|
||||
${0}
|
||||
default:
|
||||
${2}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cdirx "console.dirxml" b
|
||||
console.dirxml(${1:object});
|
||||
snippet case "case 'xyz': ... break"
|
||||
case`!p snip.rv = keyword_spacing(snip)`'${VISUAL}${1:case}':
|
||||
${VISUAL}$0
|
||||
break`!p snip.rv = semi(snip)`
|
||||
endsnippet
|
||||
|
||||
snippet ce "console.error" b
|
||||
console.error(${1:"${2:value}"});
|
||||
snippet do "do { ... } while (condition)"
|
||||
do`!p snip.rv = keyword_spacing(snip)`{
|
||||
${VISUAL}$0
|
||||
}`!p snip.rv = keyword_spacing(snip)`while`!p snip.rv = keyword_spacing(snip)`(${1:/* condition */})`!p snip.rv = semi(snip)`
|
||||
endsnippet
|
||||
|
||||
snippet cgroup "console.group" b
|
||||
console.group("${1:label}");
|
||||
${VISUAL}$0
|
||||
console.groupEnd();
|
||||
snippet ret "Return statement"
|
||||
return ${VISUAL}$0`!p snip.rv = semi(snip)`
|
||||
endsnippet
|
||||
|
||||
snippet cgroupc "console.groupCollapsed" b
|
||||
console.groupCollapsed("${1:label}");
|
||||
${VISUAL}$0
|
||||
console.groupEnd();
|
||||
endsnippet
|
||||
|
||||
snippet ci "console.info" b
|
||||
console.info(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
snippet cl "console.log" b
|
||||
console.log(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
snippet cd "console.debug" b
|
||||
console.debug(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
snippet cprof "console.profile" b
|
||||
console.profile("${1:label}");
|
||||
${VISUAL}$0
|
||||
console.profileEnd();
|
||||
endsnippet
|
||||
|
||||
snippet ctable "console.table" b
|
||||
console.table(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
snippet ctime "console.time" b
|
||||
console.time("${1:label}");
|
||||
${VISUAL}$0
|
||||
console.timeEnd("$1");
|
||||
endsnippet
|
||||
|
||||
snippet ctimestamp "console.timeStamp" b
|
||||
console.timeStamp("${1:label}");
|
||||
endsnippet
|
||||
|
||||
snippet ctrace "console.trace" b
|
||||
console.trace();
|
||||
endsnippet
|
||||
|
||||
snippet cw "console.warn" b
|
||||
console.warn(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
# AMD (Asynchronous Module Definition) snippets
|
||||
|
||||
snippet def "define an AMD module"
|
||||
define(${1:optional_name, }[${2:'jquery'}], ${3:callback});
|
||||
endsnippet
|
||||
|
||||
snippet req "require an AMD module"
|
||||
require([${1:'dependencies'}], ${2:callback});
|
||||
snippet us
|
||||
'use strict'`!p snip.rv = semi(snip)`
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -1,67 +0,0 @@
|
||||
priority -50
|
||||
|
||||
snippet iti "it (js, inject)" b
|
||||
it('${1:description}', inject(function($2) {
|
||||
$0
|
||||
}));
|
||||
endsnippet
|
||||
|
||||
snippet befi "before each (js, inject)" b
|
||||
beforeEach(inject(function($1) {
|
||||
$0
|
||||
}));
|
||||
endsnippet
|
||||
|
||||
snippet aconf "angular config" i
|
||||
config(function($1) {
|
||||
$0
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet acont "angular controller" i
|
||||
controller('${1:name}', ['${2:param_annotation}', function(${3:param}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet aconts "angular controller with scope" i
|
||||
controller('${1:name}', ['$scope', function($scope) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet adir "angular directive" i
|
||||
directive('${1:name}', ['${2:param_annotation}', function(${3:param}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet adirs "angular directive with scope" i
|
||||
directive('${1:name}', ['$scope', function($scope) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet afact "angular factory" i
|
||||
factory('${1:name}', ['${2:param_annotation}', function(${3:param}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet afacts "angular factory with scope" i
|
||||
factory('${1:name}', ['$scope', function($scope) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet aserv "angular service" i
|
||||
service('${1:name}', ['${2:param_annotation}', function(${3:param}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet aservs "angular service" i
|
||||
service('${1:name}', ['$scope', function($scope) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
@ -4,7 +4,7 @@ snippet s "String" b
|
||||
"${1:key}": "${0:value}",
|
||||
endsnippet
|
||||
|
||||
snippet n "number" b
|
||||
snippet n "Number" b
|
||||
"${1:key}": ${0:value},
|
||||
endsnippet
|
||||
|
||||
@ -13,8 +13,39 @@ snippet a "Array" b
|
||||
${VISUAL}$0
|
||||
],
|
||||
endsnippet
|
||||
|
||||
snippet na "Named array" b
|
||||
"${1:key}": [
|
||||
${VISUAL}$0
|
||||
],
|
||||
endsnippet
|
||||
|
||||
snippet o "Object" b
|
||||
{
|
||||
${VISUAL}$0
|
||||
},
|
||||
endsnippet
|
||||
|
||||
snippet no "Named object" b
|
||||
"${1:key}": {
|
||||
${VISUAL}$0
|
||||
},
|
||||
endsnippet
|
||||
|
||||
snippet null "Null" b
|
||||
"${0:key}": null,
|
||||
endsnippet
|
||||
|
||||
|
||||
global !p
|
||||
def compB(t, opts):
|
||||
if t:
|
||||
opts = [m[len(t):] for m in opts if m.startswith(t)]
|
||||
if len(opts) == 1:
|
||||
return opts[0]
|
||||
return "(" + '|'.join(opts) + ')'
|
||||
endglobal
|
||||
|
||||
snippet b "Bool" b
|
||||
"${1:key}": $2`!p snip.rv=compB(t[2], ['true', 'false'])`,
|
||||
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
|
||||
|
@ -1,5 +1,27 @@
|
||||
priority -50
|
||||
|
||||
global !p
|
||||
def create_table(snip):
|
||||
# retrieving single line from current string and treat it like tabstops count
|
||||
placeholders_string = snip.buffer[snip.line].strip().split("x",1)
|
||||
rows_amount = int(placeholders_string[0])
|
||||
columns_amount = int(placeholders_string[1])
|
||||
|
||||
# erase current line
|
||||
snip.buffer[snip.line] = ''
|
||||
|
||||
# create anonymous snippet with expected content and number of tabstops
|
||||
anon_snippet_title = ' | '.join(['$' + str(col) for col in range(1,columns_amount+1)]) + "\n"
|
||||
anon_snippet_delimiter = ':-|' * (columns_amount-1) + ":-\n"
|
||||
anon_snippet_body = ""
|
||||
for row in range(1,rows_amount+1):
|
||||
anon_snippet_body += ' | '.join(['$' + str(row*columns_amount+col) for col in range(1,columns_amount+1)]) + "\n"
|
||||
anon_snippet_table = anon_snippet_title + anon_snippet_delimiter + anon_snippet_body
|
||||
|
||||
# expand anonymous snippet
|
||||
snip.expand_anon(anon_snippet_table)
|
||||
endglobal
|
||||
|
||||
###########################
|
||||
# Sections and Paragraphs #
|
||||
###########################
|
||||
@ -50,4 +72,21 @@ $1
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet refl "Reference Link"
|
||||
[${1:${VISUAL:Text}}][${2:id}]$0
|
||||
|
||||
[$2]:${4:http://${3:www.url.com}} "${5:$4}"
|
||||
endsnippet
|
||||
|
||||
snippet fnt "Footnote"
|
||||
[^${1:${VISUAL:Footnote}}]$0
|
||||
|
||||
[^$1]:${2:Text}
|
||||
endsnippet
|
||||
|
||||
post_jump "create_table(snip)"
|
||||
snippet "tb(\d+x\d+)" "Customizable table" br
|
||||
`!p snip.rv = match.group(1)`
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
24
sources_non_forked/vim-snippets/UltiSnips/matlab.snippets
Normal file
24
sources_non_forked/vim-snippets/UltiSnips/matlab.snippets
Normal file
@ -0,0 +1,24 @@
|
||||
priority -50
|
||||
|
||||
snippet switch "switch ... otherwise"
|
||||
switch ${1:n}
|
||||
case ${2:0}
|
||||
${3}${4:
|
||||
otherwise
|
||||
${5}}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet clc "class with constructor" b
|
||||
classdef ${1:`!p
|
||||
snip.rv = snip.basename or "class_name"`}
|
||||
properties
|
||||
${2}
|
||||
end
|
||||
methods
|
||||
function obj = $1(${3})
|
||||
${4}
|
||||
end${0}
|
||||
end
|
||||
end
|
||||
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")`}
|
||||
|
||||
|
270
sources_non_forked/vim-snippets/UltiSnips/php-laravel.snippets
Normal file
270
sources_non_forked/vim-snippets/UltiSnips/php-laravel.snippets
Normal file
@ -0,0 +1,270 @@
|
||||
#resource controller
|
||||
snippet l_rsc "Laravel resource controller" b
|
||||
/*!
|
||||
* \class $1
|
||||
*
|
||||
* \author ${3:`!v g:snips_author`}
|
||||
* \date `!v strftime('%d-%m-%y')`
|
||||
*/
|
||||
|
||||
class ${1:`!v expand('%:t:r')`} extends ${2:BaseController} {
|
||||
function __construct() {
|
||||
}
|
||||
|
||||
public function index() {
|
||||
}
|
||||
|
||||
public function create() {
|
||||
}
|
||||
|
||||
public function store() {
|
||||
}
|
||||
|
||||
public function show($id) {
|
||||
}
|
||||
|
||||
public function edit($id) {
|
||||
}
|
||||
|
||||
public function update($id) {
|
||||
}
|
||||
|
||||
public function destroy($id) {
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
#service service provider
|
||||
snippet l_ssp "Laravel service provider for service" b
|
||||
<?php
|
||||
|
||||
/*!
|
||||
* \namespace $1
|
||||
* \class $2
|
||||
*
|
||||
* \author ${3:`!v g:snips_author`}
|
||||
* \date `!v strftime('%d-%m-%y')`
|
||||
*/
|
||||
|
||||
namespace ${1:Services};
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ${2:`!v expand('%:t:r')`} extends ServiceProvider {
|
||||
|
||||
public function register() {
|
||||
$this->app->bind('$4Service', function ($app) {
|
||||
return new $5(
|
||||
$app->make('Repositories\\$6Interface')
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
#repository service provider
|
||||
snippet l_rsp "Laravel service provider for repository" b
|
||||
<?php
|
||||
|
||||
/*!
|
||||
* \namespace $2
|
||||
* \class $3
|
||||
*
|
||||
* \author ${4:`!v g:snips_author`}
|
||||
* \date `!v strftime('%d-%m-%y')`
|
||||
*/
|
||||
|
||||
namespace ${2:Repositories\\${1:}};
|
||||
|
||||
use Entities\\$1;
|
||||
use $2\\$1Repository;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ${3:`!v expand('%:t:r')`} extends ServiceProvider {
|
||||
/*!
|
||||
* \var defer
|
||||
* \brief Defer service
|
||||
*/
|
||||
protected $defer = ${5:true};
|
||||
|
||||
public function register() {
|
||||
$this->app->bind('$2\\$1Interface', function($app) {
|
||||
return new $1Repository(new $1());
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief If $defer == true need this fn
|
||||
*/
|
||||
public function provides() {
|
||||
return ['$2\\$1Interface'];
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
#model
|
||||
snippet l_md "Laravel simple model" b
|
||||
<?php
|
||||
|
||||
/*!
|
||||
* \namespace $1
|
||||
* \class $2
|
||||
*
|
||||
* \author ${3:`!v g:snips_author`}
|
||||
* \date `!v strftime('%d-%m-%y')`
|
||||
*/
|
||||
|
||||
namespace ${1:Entities};
|
||||
|
||||
class ${2:`!v expand('%:t:r')`} extends \Eloquent {
|
||||
protected $table = '${4:`!p snip.rv = t[2].lower()`}';
|
||||
|
||||
public $timestamps = ${5:false};
|
||||
|
||||
protected $hidden = [$6];
|
||||
|
||||
protected $guarded = [${7:'id'}];
|
||||
}
|
||||
endsnippet
|
||||
|
||||
#abstract repository
|
||||
snippet l_ar "Laravel abstract Repository" b
|
||||
<?php
|
||||
|
||||
/*!
|
||||
* \namespace $1
|
||||
* \class $2
|
||||
* \implements $3
|
||||
*
|
||||
* \author ${4:`!v g:snips_author`}
|
||||
* \date `!v strftime('%d-%m-%y')`
|
||||
*/
|
||||
|
||||
namespace ${1:Repositories};
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
abstract class ${2:`!v expand('%:t:r')`} implements ${3:BaseRepositoryInterface} {
|
||||
protected $model;
|
||||
|
||||
/*!
|
||||
* \fn __construct
|
||||
*
|
||||
* \brief Take the model
|
||||
*/
|
||||
|
||||
public function __construct(Model $model) {
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \fn all
|
||||
*
|
||||
* \return Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public function all($columns = ['*']) {
|
||||
return $this->model->all()->toArray();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \fn create
|
||||
*
|
||||
* \return Illuminate\Database\Eloquent\Model
|
||||
*/
|
||||
public function create(array $attributes) {
|
||||
return $this->model->create($attributes);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \fn destroy
|
||||
*
|
||||
* \return int
|
||||
*/
|
||||
public function destroy($ids) {
|
||||
return $this->model->destroy($ids);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \fn find
|
||||
*
|
||||
* \return mixed
|
||||
*/
|
||||
public function find($id, $columns = ['*']) {
|
||||
return $this->model->find($id, $columns);
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
#repository
|
||||
snippet l_r "Laravel Repository" b
|
||||
<?php
|
||||
|
||||
/*!
|
||||
* \namespace $1
|
||||
* \class $3
|
||||
* \implements $4
|
||||
*
|
||||
* \author ${5:`!v g:snips_author`}
|
||||
* \date `!v strftime('%d-%m-%y')`
|
||||
*/
|
||||
|
||||
namespace ${1:Repositories\\$2};
|
||||
|
||||
class ${3:`!v expand('%:t:r')`} extends \\$6 implements ${4:$3RepositoryInterface} {
|
||||
$7
|
||||
}
|
||||
endsnippet
|
||||
|
||||
#service
|
||||
snippet l_s "Laravel Service" b
|
||||
<?php
|
||||
|
||||
/*!
|
||||
* \namespace $1
|
||||
* \class $2
|
||||
*
|
||||
* \author ${6:`!v g:snips_author`}
|
||||
* \date `!v strftime('%d-%m-%y')`
|
||||
*/
|
||||
|
||||
namespace Services\\$1;
|
||||
|
||||
use ${3:Repositories\\${4:Interface}};
|
||||
|
||||
class ${2:`!v expand('%:t:r')`} {
|
||||
protected $${5:repo};
|
||||
|
||||
/*!
|
||||
* \fn __construct
|
||||
*/
|
||||
public function __construct($4 $repo) {
|
||||
$this->$5 = $repo;
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
#facade
|
||||
snippet l_f "Laravel Facade" b
|
||||
<?php
|
||||
|
||||
/*!
|
||||
* \namespace $1
|
||||
* \class $2
|
||||
*
|
||||
* \author ${5:`!v g:snips_author`}
|
||||
* \date `!v strftime('%d-%m-%y')`
|
||||
*/
|
||||
|
||||
namespace ${1:Services};
|
||||
|
||||
use \Illuminate\Support\Facades\Facade;
|
||||
|
||||
class ${2:`!v expand('%:t:r')`} extends Facade {
|
||||
/*!
|
||||
* \fn getFacadeAccessor
|
||||
*
|
||||
* \return string
|
||||
*/
|
||||
protected static function getFacadeAccessor() { return '${4:$3Service}'; }
|
||||
}
|
||||
endsnippet
|
222
sources_non_forked/vim-snippets/UltiSnips/php-phpspec.snippets
Normal file
222
sources_non_forked/vim-snippets/UltiSnips/php-phpspec.snippets
Normal file
@ -0,0 +1,222 @@
|
||||
# Snippets for phpspec, to use add the following to your .vimrc
|
||||
# `autocmd BufRead,BufNewFile,BufEnter *Spec.php UltiSnipsAddFiletypes php-phpspec`
|
||||
|
||||
priority -50
|
||||
|
||||
snippet spec "class XYZSpec extends ObjectBehaviour"
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
|
||||
/**
|
||||
* @author `!v g:snips_author`
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
` extends ObjectBehavior
|
||||
{
|
||||
function it_$1()
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet it "function it_does_something() { ... }"
|
||||
function it_$1()
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet let "function let() { ... }"
|
||||
function let()
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet letgo "function letgo() { ... }"
|
||||
function letgo()
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# Object construction
|
||||
snippet cw "$this->beConstructedWith($arg)"
|
||||
$this->beConstructedWith($1);
|
||||
endsnippet
|
||||
|
||||
snippet ct "$this->beConstructedThrough($methodName, [$arg])"
|
||||
$this->beConstructedThrough(${1:'methodName'}, [${2:'$arg'}]);
|
||||
endsnippet
|
||||
|
||||
# Identity and comparison matchers
|
||||
snippet sreturn "$this->XYZ()->shouldReturn('value')"
|
||||
$this->${1:method}()->shouldReturn(${2:'value'});
|
||||
endsnippet
|
||||
|
||||
snippet snreturn "$this->XYZ()->shouldNotReturn('value')"
|
||||
$this->${1:method}()->shouldNotReturn(${2:'value'});
|
||||
endsnippet
|
||||
|
||||
snippet sbe "$this->XYZ()->shouldBe('value')"
|
||||
$this->${1:method}()->shouldBe(${2:'value'});
|
||||
endsnippet
|
||||
|
||||
snippet snbe "$this->XYZ()->shouldNotBe('value')"
|
||||
$this->${1:method}()->shouldNotBe(${2:'value'});
|
||||
endsnippet
|
||||
|
||||
snippet sequal "$this->XYZ()->shouldEqual('value')"
|
||||
$this->${1:method}()->shouldEqual(${2:'value'});
|
||||
endsnippet
|
||||
|
||||
snippet snequal "$this->XYZ()->shouldNotEqual('value')"
|
||||
$this->${1:method}()->shouldNotEqual(${2:'value'});
|
||||
endsnippet
|
||||
|
||||
snippet sbequalto "$this->XYZ()->shouldBeEqualTo('value')"
|
||||
$this->${1:method}()->shouldBeEqualTo(${2:'value'});
|
||||
endsnippet
|
||||
|
||||
snippet snbequalto "$this->XYZ()->shouldNotBeEqualTo('value')"
|
||||
$this->${1:method}()->shouldNotBeEqualTo(${2:'value'});
|
||||
endsnippet
|
||||
|
||||
snippet sblike "$this->XYZ()->shouldBeLike('value')"
|
||||
$this->${1:method}()->shouldBeLike(${2:'value'});
|
||||
endsnippet
|
||||
|
||||
snippet snblike "$this->XYZ()->shouldNotBeLike('value')"
|
||||
$this->${1:method}()->shouldNotBeLike(${2:'value'});
|
||||
endsnippet
|
||||
|
||||
# Throw matcher
|
||||
snippet sthrowm "$this->shouldThrow('\Exception')->duringXYZ($arg)"
|
||||
$this->shouldThrow(${1:'\Exception'})->during${2:Method}(${3:'$arg'});
|
||||
endsnippet
|
||||
|
||||
snippet sthrowi "$this->shouldThrow('\Exception')->duringInstantiation()"
|
||||
$this->shouldThrow(${1:'\Exception'})->duringInstantiation();
|
||||
endsnippet
|
||||
|
||||
# Type matchers
|
||||
snippet stype "$this->shouldHaveType('Type')"
|
||||
$this->shouldHaveType($1);
|
||||
endsnippet
|
||||
|
||||
snippet sntype "$this->shouldNotHaveType('Type')"
|
||||
$this->shouldNotHaveType($1);
|
||||
endsnippet
|
||||
|
||||
snippet srinstance "$this->shouldReturnAnInstanceOf('Type')"
|
||||
$this->shouldReturnAnInstanceOf($1);
|
||||
endsnippet
|
||||
|
||||
snippet snrinstance "$this->shouldNotReturnAnInstanceOf('Type')"
|
||||
$this->shouldNotReturnAnInstanceOf($1);
|
||||
endsnippet
|
||||
|
||||
snippet sbinstance "$this->shouldBeAnInstanceOf('Type')"
|
||||
$this->shouldBeAnInstanceOf($1);
|
||||
endsnippet
|
||||
|
||||
snippet snbinstance "$this->shouldNotBeAnInstanceOf('Type')"
|
||||
$this->shouldNotBeAnInstanceOf($1);
|
||||
endsnippet
|
||||
|
||||
snippet simplement "$this->shouldImplement('Type')"
|
||||
$this->shouldImplement($1);
|
||||
endsnippet
|
||||
|
||||
snippet snimplement "$this->shouldNotImplement('Type')"
|
||||
$this->shouldNotImplement($1);
|
||||
endsnippet
|
||||
|
||||
# Object state matchers
|
||||
snippet sbstate "$this->shouldBeXYZ()"
|
||||
$this->shouldBe$1();
|
||||
endsnippet
|
||||
|
||||
snippet snbstate "$this->shouldNotBeXYZ()"
|
||||
$this->shouldNotBe$1();
|
||||
endsnippet
|
||||
|
||||
# Count matchers
|
||||
snippet scount "$this->XYZ()->shouldHaveCount(7)"
|
||||
$this->${1:method}()->shouldHaveCount(${2:7});
|
||||
endsnippet
|
||||
|
||||
snippet sncount "$this->XYZ()->shouldNotHaveCount(7)"
|
||||
$this->${1:method}()->shouldNotHaveCount(${2:7});
|
||||
endsnippet
|
||||
|
||||
# Scalar type matchers
|
||||
snippet sbscalar "$this->XYZ()->shouldBeString|Array|Bool()"
|
||||
$this->${1:method}()->shouldBe${2:String|Array|Bool}();
|
||||
endsnippet
|
||||
|
||||
snippet snbscalar "$this->XYZ()->shouldNotBeString|Array|Bool()"
|
||||
$this->${1:method}()->shouldNotBe${2:String|Array|Bool}();
|
||||
endsnippet
|
||||
|
||||
# Contain matcher
|
||||
snippet scontain "$this->XYZ()->shouldContain('value')"
|
||||
$this->${1:method}()->shouldContain(${2:'value'});
|
||||
endsnippet
|
||||
|
||||
snippet sncontain "$this->XYZ()->shouldNotContain('value')"
|
||||
$this->${1:method}()->shouldNotContain(${2:'value'});
|
||||
endsnippet
|
||||
|
||||
# Array matchers
|
||||
snippet skey "$this->XYZ()->shouldHaveKey('key')"
|
||||
$this->${1:method}()->shouldHaveKey(${2:'key'});
|
||||
endsnippet
|
||||
|
||||
snippet snkey "$this->XYZ()->shouldNotHaveKey('key')"
|
||||
$this->${1:method}()->shouldNotHaveKey(${2:'key'});
|
||||
endsnippet
|
||||
|
||||
snippet skeyvalue "$this->XYZ()->shouldHaveKeyWithValue('key', 'value')"
|
||||
$this->${1:method}()->shouldHaveKeyWithValue(${2:'key'}, ${3:'value'});
|
||||
endsnippet
|
||||
|
||||
snippet snkeyvalue "$this->XYZ()->shouldNotHaveKeyWithValue('key', 'value')"
|
||||
$this->${1:method}()->shouldNotHaveKeyWithValue(${2:'key'}, ${3:'value'});
|
||||
endsnippet
|
||||
|
||||
# String matchers
|
||||
snippet sstart "$this->XYZ()->shouldStartWith('string')"
|
||||
$this->${1:method}()->shouldStartWith(${2:'string'});
|
||||
endsnippet
|
||||
|
||||
snippet snstart "$this->XYZ()->shouldNotStartWith('string')"
|
||||
$this->${1:method}()->shouldNotStartWith(${2:'string'});
|
||||
endsnippet
|
||||
|
||||
snippet send "$this->XYZ()->shouldEndWith('string')"
|
||||
$this->${1:method}()->shouldEndWith(${2:'string'});
|
||||
endsnippet
|
||||
|
||||
snippet snend "$this->XYZ()->shouldNotEndWith('string')"
|
||||
$this->${1:method}()->shouldNotEndWith(${2:'string'});
|
||||
endsnippet
|
||||
|
||||
snippet smatch "$this->XYZ()->shouldMatch('/wizard/i')"
|
||||
$this->${1:method}()->shouldMatch(${2:'/wizard/i'});
|
||||
endsnippet
|
||||
|
||||
snippet snmatch "$this->XYZ()->shouldNotMatch('/wizard/i')"
|
||||
$this->${1:method}()->shouldNotMatch(${2:'/wizard/i'});
|
||||
endsnippet
|
@ -4,15 +4,17 @@
|
||||
priority -50
|
||||
|
||||
snippet classn "Basic class with namespace snippet" b
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
|
||||
/**
|
||||
* ${1:@author `whoami`}
|
||||
* ${1:@author `!v g:snips_author`}
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
@ -26,9 +28,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
endsnippet
|
||||
|
||||
snippet contr "Symfony2 controller" b
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
@ -40,7 +44,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* ${1:@author `whoami`}
|
||||
* ${1:@author `!v g:snips_author`}
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
@ -49,36 +53,50 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet sfa "Symfony 2 Controller action"
|
||||
/**
|
||||
* @Route("/${1:route_name}", name="$1")
|
||||
* @Template()
|
||||
*/
|
||||
public function $1Action($2)
|
||||
{
|
||||
$3
|
||||
return ${4:[];}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet act "Symfony2 action" b
|
||||
/**
|
||||
* @Route("${3}", name="${4}")
|
||||
* @Route("$3", name="$4")
|
||||
* @Method({${5:"POST"}})
|
||||
* @Template()
|
||||
*/
|
||||
public function ${1}Action(${2})
|
||||
public function $1Action($2)
|
||||
{
|
||||
${6}
|
||||
$6
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet actt "Symfony2 action and template" b
|
||||
/**
|
||||
* @Route("${3}", name="${4}")
|
||||
* @Route("$3", name="$4")
|
||||
* @Method({${5:"GET"}})
|
||||
* @Template()
|
||||
*/
|
||||
public function ${1}Action(${2})
|
||||
public function $1Action($2)
|
||||
{
|
||||
${6}
|
||||
$6
|
||||
return [];
|
||||
}`!p
|
||||
abspath = os.path.abspath(path)`
|
||||
relpath = os.path.relpath(path)`
|
||||
endsnippet
|
||||
|
||||
snippet comm "Symfony2 command" b
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
@ -90,7 +108,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* ${3:@author `whoami`}
|
||||
* ${3:@author `!v g:snips_author`}
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
@ -98,8 +116,8 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('${1}')
|
||||
->setDescription('${2}')
|
||||
$this->setName('$1')
|
||||
->setDescription('$2')
|
||||
->setDefinition([
|
||||
new InputArgument('', InputArgument::REQUIRED, ''),
|
||||
new InputOption('', null, InputOption::VALUE_NONE, ''),
|
||||
@ -113,9 +131,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
endsnippet
|
||||
|
||||
snippet subs "Symfony2 subscriber" b
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
@ -123,7 +143,7 @@ if m:
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
/**
|
||||
* ${1:@author `whoami`}
|
||||
* ${1:@author `!v g:snips_author`}
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
@ -144,9 +164,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
endsnippet
|
||||
|
||||
snippet transf "Symfony2 form data transformer" b
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
@ -155,7 +177,7 @@ use Symfony\Component\Form\DataTransformerInterface;
|
||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||
|
||||
/**
|
||||
* ${3:@author `whoami`}
|
||||
* ${3:@author `!v g:snips_author`}
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
@ -164,23 +186,25 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function transform(${1})
|
||||
public function transform($1)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function reverseTransform(${2})
|
||||
public function reverseTransform($2)
|
||||
{
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ent "Symfony2 doctrine entity" b
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
@ -188,7 +212,7 @@ if m:
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* ${3:@author `whoami`}
|
||||
* ${3:@author `!v g:snips_author`}
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(name="`!p
|
||||
@ -215,9 +239,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
endsnippet
|
||||
|
||||
snippet form "Symfony2 form type" b
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
@ -227,7 +253,7 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
|
||||
/**
|
||||
* ${2:@author `whoami`}
|
||||
* ${2:@author `!v g:snips_author`}
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
@ -253,15 +279,17 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return '${1}';
|
||||
return '$1';
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ev "Symfony2 event" b
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
@ -269,7 +297,7 @@ if m:
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* ${2:@author `whoami`}
|
||||
* ${2:@author `!v g:snips_author`}
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
@ -278,6 +306,55 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet redir "Symfony2 redirect"
|
||||
$this->redirect($this->generateUrl('${1}', ${2}));
|
||||
snippet redir "Symfony2 redirect" b
|
||||
$this->redirect($this->generateUrl('$1', $2));
|
||||
endsnippet
|
||||
|
||||
snippet usecontroller "Symfony2 use Symfony\..\Controller" b
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;$1
|
||||
endsnippet
|
||||
|
||||
snippet usereauest "Symfony2 use Symfony\..\Request" b
|
||||
use Symfony\Component\HttpFoundation\Request;$1
|
||||
endsnippet
|
||||
|
||||
snippet useroute "Symfony2 use Sensio\..\Route" b
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;$1
|
||||
endsnippet
|
||||
|
||||
snippet useresponse "Symfony2 use Symfony\..\Response" b
|
||||
use Symfony\Component\HttpFoundation\Response;$1
|
||||
endsnippet
|
||||
|
||||
snippet usefile "Symfony2 use Symfony\..\File" b
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;$1
|
||||
endsnippet
|
||||
|
||||
snippet useassert "Symfony2 use Symfony\..\Constraints as Assert" b
|
||||
use Symfony\Component\Validator\Constraints as Assert;$1
|
||||
endsnippet
|
||||
|
||||
snippet usetemplate "Symfony2 use Sensio\..\Template" b
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;$1
|
||||
endsnippet
|
||||
|
||||
snippet usecache "Symfony2 use Sensio\..\Cache" b
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;$1
|
||||
endsnippet
|
||||
|
||||
snippet usemethod "Symfony2 use Sensio\..\Method" b
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;$1
|
||||
endsnippet
|
||||
|
||||
snippet usearray "Symfony2 use Doctrine\..\ArrayCollection" b
|
||||
use Doctrine\Common\Collections\ArrayCollection;$1
|
||||
endsnippet
|
||||
|
||||
snippet useorm "Symfony2 use Doctrine\..\Mapping as ORM" b
|
||||
use Doctrine\ORM\Mapping as ORM;$1
|
||||
endsnippet
|
||||
|
||||
snippet usesecure "Symfony2 use JMS\..\Secure" b
|
||||
use JMS\SecurityExtraBundle\Annotation\Secure;$1
|
||||
endsnippet
|
||||
|
@ -1,147 +1,67 @@
|
||||
priority -50
|
||||
|
||||
global !p
|
||||
import vim
|
||||
|
||||
# Set g:ultisnips_php_scalar_types to 1 if you'd like to enable PHP 7's scalar types for return values
|
||||
def isPHPScalarTypesEnabled():
|
||||
isEnabled = vim.eval("get(g:, 'ultisnips_php_scalar_types', 0)") == "1"
|
||||
return isEnabled or re.match('<\?php\s+declare\(strict_types=[01]\);', '\n'.join(vim.current.window.buffer))
|
||||
endglobal
|
||||
|
||||
## Snippets from SnipMate, taken from
|
||||
## https://github.com/scrooloose/snipmate-snippets.git
|
||||
|
||||
snippet array "array"
|
||||
$${1:arrayName} = array('${2}' => ${3});${4}
|
||||
endsnippet
|
||||
|
||||
snippet def "def"
|
||||
define('${1}'${2});${3}
|
||||
endsnippet
|
||||
|
||||
snippet do "do"
|
||||
do {
|
||||
${2:// code... }
|
||||
} while (${1:/* condition */});
|
||||
endsnippet
|
||||
|
||||
snippet doc_f "doc_f"
|
||||
snippet gm "PHP Class Getter" b
|
||||
/**
|
||||
* $2
|
||||
* @return ${4:void}
|
||||
* @author ${5:`!v g:snips_author`}
|
||||
**/
|
||||
${1:public }function ${2:someFunc}(${3})
|
||||
{${6}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet doc_i "doc_i"
|
||||
/**
|
||||
* $1
|
||||
* @package ${2:default}
|
||||
* @author ${3:`!v g:snips_author`}
|
||||
**/
|
||||
interface ${1:someClass}
|
||||
{${4}
|
||||
} // END interface $1"
|
||||
endsnippet
|
||||
|
||||
snippet else "else"
|
||||
else {
|
||||
${1:// code...}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "for"
|
||||
for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
|
||||
${4:// code...}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet foreachk "foreachk"
|
||||
foreach ($${1:variable} as $${2:key} => $${3:value}){
|
||||
${4:// code...}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet get "get"
|
||||
$_GET['${1}']${2}
|
||||
endsnippet
|
||||
|
||||
snippet if "if"
|
||||
if (${1:/* condition */}) {
|
||||
${2:// code...}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet elif "elseif"
|
||||
elseif (${1:/* condition */}) {
|
||||
${2:// code...}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet inc "inc"
|
||||
include '${1:file}';${2}
|
||||
endsnippet
|
||||
|
||||
snippet log "log"
|
||||
error_log(var_export(${1}, true));${2}
|
||||
endsnippet
|
||||
|
||||
snippet post "post"
|
||||
$_POST['${1}']${2}
|
||||
endsnippet
|
||||
|
||||
snippet req1 "req1"
|
||||
require_once '${1:file}';${2}
|
||||
endsnippet
|
||||
|
||||
snippet session "session"
|
||||
$_SESSION['${1}']${2}
|
||||
endsnippet
|
||||
|
||||
snippet t "t"
|
||||
$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5}
|
||||
endsnippet
|
||||
|
||||
snippet var "var"
|
||||
var_export(${1});${2}
|
||||
endsnippet
|
||||
|
||||
snippet getter "PHP Class Getter" b
|
||||
/*
|
||||
* Getter for $1
|
||||
*
|
||||
* @return ${2:string}
|
||||
*/
|
||||
public function get${1/\w+\s*/\u$0/}()
|
||||
public function get${1/\w+\s*/\u$0/}()`!p snip.rv = ': '+t[2] if isPHPScalarTypesEnabled() else ''`
|
||||
{
|
||||
return $this->$1;$2
|
||||
return $this->$1;
|
||||
}
|
||||
$4
|
||||
endsnippet
|
||||
|
||||
snippet setter "PHP Class Setter" b
|
||||
/*
|
||||
snippet sm "PHP Class Setter" b
|
||||
/**
|
||||
* Setter for $1
|
||||
*
|
||||
* @param ${2:string} $$1
|
||||
* @return ${3:`!p snip.rv=snip.basename`}
|
||||
*/
|
||||
public function set${1/\w+\s*/\u$0/}($$1)
|
||||
public function set${1/\w+\s*/\u$0/}(${4:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1)
|
||||
{
|
||||
$this->$1 = $$1;$3
|
||||
${4:return $this;}
|
||||
$this->$1 = $$1;
|
||||
|
||||
${5:return $this;}
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet gs "PHP Class Getter Setter" b
|
||||
/*
|
||||
/**
|
||||
* Getter for $1
|
||||
*
|
||||
* @return ${2:string}
|
||||
*/
|
||||
public function get${1/\w+\s*/\u$0/}()
|
||||
public function get${1/\w+\s*/\u$0/}()`!p snip.rv = ': '+t[2] if isPHPScalarTypesEnabled() else ''`
|
||||
{
|
||||
return $this->$1;$2
|
||||
return $this->$1;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Setter for $1
|
||||
*
|
||||
* @param $2 $$1
|
||||
* @return ${3:`!p snip.rv=snip.basename`}
|
||||
*/
|
||||
public function set${1/\w+\s*/\u$0/}($$1)
|
||||
public function set${1/\w+\s*/\u$0/}(${4:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1)
|
||||
{
|
||||
$this->$1 = $$1;$3
|
||||
${4:return $this;}
|
||||
$this->$1 = $$1;
|
||||
|
||||
${5:return $this;}
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet pub "Public function" b
|
||||
@ -230,55 +150,76 @@ function ${1:name}(${2:$param})
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet fore "Foreach loop"
|
||||
foreach ($${1:variable} as $${3:value}){
|
||||
${VISUAL}${4}
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet new "New class instance" b
|
||||
$$1 = new $1($2);
|
||||
$${1:variableName} = new ${2:${1/\w+\s*/\u$0/}}($3);
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ife "if else"
|
||||
if (${1:/* condition */}) {
|
||||
${2:// code...}
|
||||
} else {
|
||||
${3:// code...}
|
||||
}
|
||||
$0
|
||||
snippet ns "namespace declaration" b
|
||||
namespace ${1:`!p
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`};
|
||||
endsnippet
|
||||
|
||||
snippet class "Class declaration template" b
|
||||
<?php
|
||||
|
||||
namespace ${1:`!p
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`};
|
||||
|
||||
/**
|
||||
* Class ${2:`!p snip.rv=snip.fn.split('.')[0]`}
|
||||
* @author ${3:`!v g:snips_author`}
|
||||
* Class ${1:`!p snip.rv=snip.basename`}
|
||||
* @author ${2:`!v g:snips_author`}
|
||||
*/
|
||||
$1class $2
|
||||
class $1
|
||||
{
|
||||
public function ${4:__construct}(${5:$options})
|
||||
{
|
||||
${6:// code}
|
||||
}
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet interface "interface declaration template" b
|
||||
snippet interface "Interface declaration template" b
|
||||
<?php
|
||||
|
||||
namespace ${1:`!p
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`};
|
||||
|
||||
/**
|
||||
* Interface ${1:`!p snip.rv=snip.fn.split('.')[0]`}
|
||||
* Interface ${1:`!p snip.rv=snip.basename`}
|
||||
* @author ${2:`!v g:snips_author`}
|
||||
*/
|
||||
interface $1
|
||||
{
|
||||
public function ${3:__construct}(${4:$options})
|
||||
{
|
||||
${5:// code}
|
||||
}
|
||||
public function ${3:someFunction}();$4
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet trait "Trait declaration template" b
|
||||
<?php
|
||||
|
||||
namespace ${1:`!p
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`};
|
||||
|
||||
/**
|
||||
* Trait ${1:`!p snip.rv=snip.basename`}
|
||||
* @author ${2:`!v g:snips_author`}
|
||||
*/
|
||||
trait $1
|
||||
{
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet construct "__construct()" b
|
||||
@ -291,31 +232,29 @@ public function __construct(${1:$dependencies})
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ve "Dumb debug helper in HTML"
|
||||
echo '<pre>' . var_export($1, 1) . '</pre>';$0
|
||||
endsnippet
|
||||
# PHPUnit snippets
|
||||
snippet testcase "class XYZTest extends \PHPUnit_Framework_TestCase { ... }"
|
||||
<?php
|
||||
|
||||
snippet pc "Dumb debug helper in cli"
|
||||
var_export($1);$0
|
||||
endsnippet
|
||||
namespace `!p
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
|
||||
# Symfony 2 based snippets
|
||||
snippet sfa "Symfony 2 Controller action"
|
||||
/**
|
||||
* @Route("/${1:route_name}", name="$1")
|
||||
* @Template()
|
||||
*/
|
||||
public function $1Action($2)
|
||||
* @author `!v g:snips_author`
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
` extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$3
|
||||
return ${4:array();}$0
|
||||
public function test$1()
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet inheritdoc "@inheritdoc docblock"
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
endsnippet
|
||||
|
||||
# :vim:ft=snippets:
|
||||
|
@ -1,32 +0,0 @@
|
||||
# suggestion? report bugs?
|
||||
# please go to https://github.com/chrisyue/vim-snippets/issues
|
||||
priority -50
|
||||
|
||||
snippet test "phpunit test class" b
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
|
||||
/**
|
||||
* @author `whoami`
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
` extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test${1}()
|
||||
{
|
||||
${2}
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet exp "phpunit expects" i
|
||||
expects($this->${1:once}())
|
||||
->method('${2}')
|
||||
->with($this->equalTo(${3})${4})
|
||||
->will($this->returnValue(${5}));
|
||||
endsnippet
|
@ -32,17 +32,17 @@ endsnippet
|
||||
|
||||
snippet reqf "Required field" b
|
||||
// ${4:TODO(`whoami`): Describe this field.}
|
||||
optional ${1}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; // Required
|
||||
optional $1`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; // Required
|
||||
endsnippet
|
||||
|
||||
snippet optf "Optional field" b
|
||||
// ${4:TODO(`whoami`): Describe this field.}
|
||||
optional ${1}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1};
|
||||
optional $1`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1};
|
||||
endsnippet
|
||||
|
||||
snippet repf "Repeated field" b
|
||||
// ${4:TODO(`whoami`): Describe this field.}
|
||||
repeated ${1}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1};
|
||||
repeated $1`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1};
|
||||
endsnippet
|
||||
|
||||
snippet enum "Enumeration" b
|
||||
|
@ -133,103 +133,103 @@ endsnippet
|
||||
########################################################################
|
||||
|
||||
snippet alert "Alert Function" b
|
||||
alert("${1:message}")${0}
|
||||
alert("${1:message}")$0
|
||||
endsnippet
|
||||
|
||||
snippet crit "Crit Function" b
|
||||
crit("${1:message}")${0}
|
||||
crit("${1:message}")$0
|
||||
endsnippet
|
||||
|
||||
snippet debug "Debug Function" b
|
||||
debug("${1:message}")${0}
|
||||
debug("${1:message}")$0
|
||||
endsnippet
|
||||
|
||||
snippet defined "Defined Function" b
|
||||
defined(${1:Resource}["${2:name}"])${0}
|
||||
defined(${1:Resource}["${2:name}"])$0
|
||||
endsnippet
|
||||
|
||||
snippet emerg "Emerg Function" b
|
||||
emerg("${1:message}")${0}
|
||||
emerg("${1:message}")$0
|
||||
endsnippet
|
||||
|
||||
snippet extlookup "Simple Extlookup" b
|
||||
$${1:Variable} = extlookup("${2:Lookup}")${0}
|
||||
$${1:Variable} = extlookup("${2:Lookup}")$0
|
||||
endsnippet
|
||||
|
||||
snippet extlookup "Extlookup with defaults" b
|
||||
$${1:Variable} = extlookup("${2:Lookup}", ${3:Default})${0}
|
||||
$${1:Variable} = extlookup("${2:Lookup}", ${3:Default})$0
|
||||
endsnippet
|
||||
|
||||
snippet extlookup "Extlookup with defaults and custom data file" b
|
||||
$${1:Variable} = extlookup("${2:Lookup}", ${3:Default}, ${4:Data Source})${0}
|
||||
$${1:Variable} = extlookup("${2:Lookup}", ${3:Default}, ${4:Data Source})$0
|
||||
endsnippet
|
||||
|
||||
snippet fail "Fail Function" b
|
||||
fail("${1:message}")${0}
|
||||
fail("${1:message}")$0
|
||||
endsnippet
|
||||
|
||||
snippet hiera "Hiera Function" b
|
||||
$${1:Variable} = hiera("${2:Lookup}")${0}
|
||||
$${1:Variable} = hiera("${2:Lookup}")$0
|
||||
endsnippet
|
||||
|
||||
snippet hiera "Hiera with defaults" b
|
||||
$${1:Variable} = hiera("${2:Lookup}", ${3:Default})${0}
|
||||
$${1:Variable} = hiera("${2:Lookup}", ${3:Default})$0
|
||||
endsnippet
|
||||
|
||||
snippet hiera "Hiera with defaults and override" b
|
||||
$${1:Variable} = hiera("${2:Lookup}", ${3:Default}, ${4:Override})${0}
|
||||
$${1:Variable} = hiera("${2:Lookup}", ${3:Default}, ${4:Override})$0
|
||||
endsnippet
|
||||
|
||||
snippet hiera_hash "Hiera Hash Function" b
|
||||
$${1:Variable} = hiera_hash("${2:Lookup}")${0}
|
||||
$${1:Variable} = hiera_hash("${2:Lookup}")$0
|
||||
endsnippet
|
||||
|
||||
snippet hiera_hash "Hiera Hash with defaults" b
|
||||
$${1:Variable} = hiera_hash("${2:Lookup}", ${3:Default})${0}
|
||||
$${1:Variable} = hiera_hash("${2:Lookup}", ${3:Default})$0
|
||||
endsnippet
|
||||
|
||||
snippet hiera_hash "Hiera Hash with defaults and override" b
|
||||
$${1:Variable} = hiera_hash("${2:Lookup}", ${3:Default}, ${4:Override})${0}
|
||||
$${1:Variable} = hiera_hash("${2:Lookup}", ${3:Default}, ${4:Override})$0
|
||||
endsnippet
|
||||
|
||||
snippet hiera_include "Hiera Include Function" b
|
||||
hiera_include("${1:Lookup}")${0}
|
||||
hiera_include("${1:Lookup}")$0
|
||||
endsnippet
|
||||
|
||||
snippet include "Include Function" b
|
||||
include ${1:classname}${0}
|
||||
include ${1:classname}$0
|
||||
endsnippet
|
||||
|
||||
snippet info "Info Function" b
|
||||
info("${1:message}")${0}
|
||||
info("${1:message}")$0
|
||||
endsnippet
|
||||
|
||||
snippet inline_template "Inline Template Function" b
|
||||
inline_template("<%= ${1:template} %>")${0}
|
||||
inline_template("<%= ${1:template} %>")$0
|
||||
endsnippet
|
||||
|
||||
snippet notice "Notice Function" b
|
||||
notice("${1:message}")${0}
|
||||
notice("${1:message}")$0
|
||||
endsnippet
|
||||
|
||||
snippet realize "Realize Function" b
|
||||
realize(${1:Resource}["${2:name}"])${0}
|
||||
realize(${1:Resource}["${2:name}"])$0
|
||||
endsnippet
|
||||
|
||||
snippet regsubst "Regsubst Function" b
|
||||
regsubst($${1:Target}, '${2:regexp}', '${3:replacement}')${0}
|
||||
regsubst($${1:Target}, '${2:regexp}', '${3:replacement}')$0
|
||||
endsnippet
|
||||
|
||||
snippet split "Split Function" b
|
||||
$${1:Variable} = split($${1:Target}, '${2:regexp}')${0}
|
||||
$${1:Variable} = split($${1:Target}, '${2:regexp}')$0
|
||||
endsnippet
|
||||
|
||||
snippet versioncmp "Version Compare Function" b
|
||||
$${1:Variable} = versioncmp('${1:version}', '${2:version}')${0}
|
||||
$${1:Variable} = versioncmp('${1:version}', '${2:version}')$0
|
||||
endsnippet
|
||||
|
||||
snippet warning "Warning Function" b
|
||||
warning("${1:message}")${0}
|
||||
warning("${1:message}")$0
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -7,18 +7,24 @@ priority -50
|
||||
#! header
|
||||
snippet #! "Shebang header for python scripts" b
|
||||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
# -*- coding: utf-8 -*-
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ifmain "ifmain" b
|
||||
if __name__ == '__main__':
|
||||
${1:main()}$0
|
||||
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:pass}
|
||||
${3:${VISUAL:pass}}
|
||||
endsnippet
|
||||
|
||||
##########
|
||||
@ -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,10 +235,19 @@ 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)
|
||||
|
||||
def get_dir_and_file_name(snip):
|
||||
return os.getcwd().split(os.sep)[-1] + '.' + snip.basename
|
||||
|
||||
endglobal
|
||||
|
||||
########################################
|
||||
@ -441,13 +486,18 @@ def __coerce__(self, other):
|
||||
${25:pass}
|
||||
endsnippet
|
||||
|
||||
snippet deff
|
||||
def ${1:fname}(`!p snip.rv = vim.eval('indent(".") ? "self" : ""')`$2):
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet def "function with docstrings" b
|
||||
def ${1:function}(`!p
|
||||
if snip.indent:
|
||||
snip.rv = 'self' + (", " if len(t[2]) else "")`${2:arg1}):
|
||||
`!p snip.rv = triple_quotes(snip)`${4:TODO: Docstring for $1.}`!p
|
||||
write_function_docstring(t, snip) `
|
||||
${0:pass}
|
||||
${5:${VISUAL:pass}}
|
||||
endsnippet
|
||||
|
||||
|
||||
@ -458,7 +508,7 @@ if snip.indent:
|
||||
snip.rv = 'cls' + (", " if len(t[2]) else "")`${2:arg1}):
|
||||
`!p snip.rv = triple_quotes(snip)`${4:TODO: Docstring for $1.}`!p
|
||||
write_function_docstring(t, snip) `
|
||||
${0:pass}
|
||||
${5:${VISUAL:pass}}
|
||||
endsnippet
|
||||
|
||||
|
||||
@ -467,7 +517,7 @@ snippet defs "static method with docstrings" b
|
||||
def ${1:function}(${2:arg1}):
|
||||
`!p snip.rv = triple_quotes(snip)`${4:TODO: Docstring for $1.}`!p
|
||||
write_function_docstring(t, snip) `
|
||||
${0:pass}
|
||||
${5:${VISUAL:pass}}
|
||||
endsnippet
|
||||
|
||||
|
||||
@ -520,19 +570,19 @@ endsnippet
|
||||
####################
|
||||
snippet if "If" b
|
||||
if ${1:condition}:
|
||||
${2:pass}
|
||||
${2:${VISUAL:pass}}
|
||||
endsnippet
|
||||
|
||||
snippet ife "If / Else" b
|
||||
if ${1:condition}:
|
||||
${2:pass}
|
||||
${2:${VISUAL:pass}}
|
||||
else:
|
||||
${3:pass}
|
||||
endsnippet
|
||||
|
||||
snippet ifee "If / Elif / Else" b
|
||||
if ${1:condition}:
|
||||
${2:pass}
|
||||
${2:${VISUAL:pass}}
|
||||
elif ${3:condition}:
|
||||
${4:pass}
|
||||
else:
|
||||
@ -545,33 +595,33 @@ endsnippet
|
||||
##########################
|
||||
snippet try "Try / Except" b
|
||||
try:
|
||||
${1:pass}
|
||||
except ${2:Exception}, ${3:e}:
|
||||
${1:${VISUAL:pass}}
|
||||
except ${2:Exception} as ${3:e}:
|
||||
${4:raise $3}
|
||||
endsnippet
|
||||
|
||||
snippet try "Try / Except / Else" b
|
||||
snippet trye "Try / Except / Else" b
|
||||
try:
|
||||
${1:pass}
|
||||
except ${2:Exception}, ${3:e}:
|
||||
${1:${VISUAL:pass}}
|
||||
except ${2:Exception} as ${3:e}:
|
||||
${4:raise $3}
|
||||
else:
|
||||
${5:pass}
|
||||
endsnippet
|
||||
|
||||
snippet try "Try / Except / Finally" b
|
||||
snippet tryf "Try / Except / Finally" b
|
||||
try:
|
||||
${1:pass}
|
||||
except ${2:Exception}, ${3:e}:
|
||||
${1:${VISUAL:pass}}
|
||||
except ${2:Exception} as ${3:e}:
|
||||
${4:raise $3}
|
||||
finally:
|
||||
${5:pass}
|
||||
endsnippet
|
||||
|
||||
snippet try "Try / Except / Else / Finally" b
|
||||
snippet tryef "Try / Except / Else / Finally" b
|
||||
try:
|
||||
${1:pass}
|
||||
except${2: ${3:Exception}, ${4:e}}:
|
||||
${1:${VISUAL:pass}}
|
||||
except${2: ${3:Exception} as ${4:e}}:
|
||||
${5:raise}
|
||||
else:
|
||||
${6:pass}
|
||||
@ -580,48 +630,36 @@ finally:
|
||||
endsnippet
|
||||
|
||||
|
||||
#####################
|
||||
######################
|
||||
# Assertions & Tests #
|
||||
#####################
|
||||
|
||||
snippet pdb "Set PDB breakpoint" b
|
||||
import pdb; pdb.set_trace()
|
||||
endsnippet
|
||||
|
||||
snippet ipdb "Set IPDB breakpoint" b
|
||||
import ipdb; ipdb.set_trace()
|
||||
endsnippet
|
||||
|
||||
snippet pudb "Set PUDB breakpoint" b
|
||||
import pudb; pudb.set_trace()
|
||||
endsnippet
|
||||
######################
|
||||
|
||||
snippet ae "Assert equal" b
|
||||
self.assertEqual(${1:first},${2:second})
|
||||
self.assertEqual(${1:${VISUAL:first}},${2:second})
|
||||
endsnippet
|
||||
|
||||
snippet at "Assert True" b
|
||||
self.assertTrue(${0:exp})
|
||||
self.assertTrue(${1:${VISUAL:expression}})
|
||||
endsnippet
|
||||
|
||||
snippet af "Assert False" b
|
||||
self.assertFalse(${1:expression})
|
||||
self.assertFalse(${1:${VISUAL:expression}})
|
||||
endsnippet
|
||||
|
||||
snippet aae "Assert almost equal" b
|
||||
self.assertAlmostEqual(${1:first},${2:second})
|
||||
self.assertAlmostEqual(${1:${VISUAL:first}},${2:second})
|
||||
endsnippet
|
||||
|
||||
snippet ar "Assert raises" b
|
||||
self.assertRaises(${1:exception}, ${2:func}${3/.+/, /}${3:arguments})
|
||||
self.assertRaises(${1:exception}, ${2:${VISUAL:func}}${3/.+/, /}${3:arguments})
|
||||
endsnippet
|
||||
|
||||
snippet an "Assert is None" b
|
||||
self.assertIsNone(${0:expression})
|
||||
self.assertIsNone(${1:${VISUAL:expression}})
|
||||
endsnippet
|
||||
|
||||
snippet ann "Assert is not None" b
|
||||
self.assertIsNotNone(${0:expression})
|
||||
self.assertIsNotNone(${1:${VISUAL:expression}})
|
||||
endsnippet
|
||||
|
||||
snippet testcase "pyunit testcase" b
|
||||
@ -636,25 +674,39 @@ class Test${1:Class}(${2:unittest.TestCase}):
|
||||
${5:pass}
|
||||
|
||||
def test_${6:name}(self):
|
||||
${7:pass}
|
||||
${7:${VISUAL:pass}}
|
||||
endsnippet
|
||||
|
||||
snippet " "triple quoted string (double quotes)" b
|
||||
"""
|
||||
${1:doc}
|
||||
${1:${VISUAL:doc}}
|
||||
`!p triple_quotes_handle_trailing(snip, '"')`
|
||||
endsnippet
|
||||
|
||||
snippet ' "triple quoted string (single quotes)" b
|
||||
'''
|
||||
${1:doc}
|
||||
${1:${VISUAL:doc}}
|
||||
`!p triple_quotes_handle_trailing(snip, "'")`
|
||||
endsnippet
|
||||
|
||||
snippet doc "doc block (triple quotes)"
|
||||
`!p snip.rv = triple_quotes(snip)`
|
||||
${1:doc}
|
||||
${1:${VISUAL:doc}}
|
||||
`!p snip.rv = triple_quotes(snip)`
|
||||
endsnippet
|
||||
|
||||
snippet pmdoc "pocoo style module doc string" b
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
`!p snip.rv = get_dir_and_file_name(snip)`
|
||||
`!p snip.rv = '~' * len(get_dir_and_file_name(snip))`
|
||||
|
||||
${1:DESCRIPTION}
|
||||
|
||||
:copyright: (c) `date +%Y` by ${2:YOUR_NAME}.
|
||||
:license: ${3:LICENSE_NAME}, see LICENSE for more details.
|
||||
"""
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -24,11 +24,11 @@ setwd("${1:`!p snip.rv = os.getcwd()`}")
|
||||
endsnippet
|
||||
|
||||
snippet as "Apply type on variable" w
|
||||
as.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`(${2}${VISUAL})
|
||||
as.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`($2${VISUAL})
|
||||
endsnippet
|
||||
|
||||
snippet is "Test type on variable" w
|
||||
is.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`(${2}${VISUAL})
|
||||
is.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`($2${VISUAL})
|
||||
endsnippet
|
||||
|
||||
snippet dl "Download and install a package" b
|
||||
@ -50,50 +50,51 @@ source('${0:file}')
|
||||
endsnippet
|
||||
|
||||
snippet if "If statement"
|
||||
if (${1}) {
|
||||
${0}
|
||||
if ($1) {
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet eif "Else-If statement"
|
||||
else if (${1}) {
|
||||
${0}
|
||||
else if ($1) {
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet el "Else statement"
|
||||
else {
|
||||
${0}
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ife "if .. else"
|
||||
if (${1}) {
|
||||
${2}
|
||||
if ($1) {
|
||||
$2
|
||||
} else {
|
||||
${3}
|
||||
$3
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet wh "while loop"
|
||||
while(${1}) {
|
||||
${2}
|
||||
while($1) {
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "for loop"
|
||||
for (${1:item} in ${2:list}) {
|
||||
${3}
|
||||
$3
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fun "Function definition"
|
||||
${1:name} <- function (${2}) {
|
||||
${0}
|
||||
${1:name} <- function ($2) {
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ret "Return call"
|
||||
return(${0})
|
||||
return($0)
|
||||
endsnippet
|
||||
|
||||
snippet df "Data frame"
|
||||
|
@ -15,14 +15,14 @@ t.boolean :${1:title}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet cla "Create controller class"
|
||||
snippet clac "Create controller class"
|
||||
class ${1:Model}Controller < ApplicationController
|
||||
before_filter :find_${2:model}
|
||||
|
||||
$0
|
||||
|
||||
private
|
||||
def find_${2}
|
||||
def find_$2
|
||||
@$2 = ${3:$1}.find(params[:id]) if params[:id]
|
||||
end
|
||||
end
|
||||
@ -48,7 +48,7 @@ t.float :${1:title}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet cla "Create functional test class"
|
||||
snippet clact "Create functional test class"
|
||||
require 'test_helper'
|
||||
|
||||
class ${1:Model}ControllerTest < ActionController::TestCase
|
||||
@ -133,7 +133,7 @@ class ${1:Model}sController < ApplicationController
|
||||
# PUT /${1/./\l$0/}s/1.xml
|
||||
def update
|
||||
respond_to do |wants|
|
||||
if @${1/./\l$0/}.update_attributes(params[:${1/./\l$0/}])
|
||||
if @${1/./\l$0/}.update(params[:${1/./\l$0/}])
|
||||
flash[:notice] = '${1:Model} was successfully updated.'
|
||||
wants.html { redirect_to(@${1/./\l$0/}) }
|
||||
wants.xml { head :ok }
|
||||
@ -253,7 +253,7 @@ after_validation_on_update $0
|
||||
endsnippet
|
||||
|
||||
snippet asg "assert(var = assigns(:var))"
|
||||
assert(${1:var} = assigns(:${1}), "Cannot find @${1}")
|
||||
assert(${1:var} = assigns(:$1), "Cannot find @$1")
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
@ -270,11 +270,11 @@ end
|
||||
endsnippet
|
||||
|
||||
snippet artnpp "assert_redirected_to (nested path plural)"
|
||||
assert_redirected_to ${10:${2:parent}_${3:child}_path(${4:@}${5:${2}})}
|
||||
assert_redirected_to ${10:${2:parent}_${3:child}_path(${4:@}${5:$2})}
|
||||
endsnippet
|
||||
|
||||
snippet artnp "assert_redirected_to (nested path)"
|
||||
assert_redirected_to ${2:${12:parent}_${13:child}_path(${14:@}${15:${12}}, ${16:@}${17:${13}})}
|
||||
assert_redirected_to ${2:${12:parent}_${13:child}_path(${14:@}${15:$12}, ${16:@}${17:$13})}
|
||||
endsnippet
|
||||
|
||||
snippet artpp "assert_redirected_to (path plural)"
|
||||
@ -282,7 +282,7 @@ assert_redirected_to ${10:${2:model}s_path}
|
||||
endsnippet
|
||||
|
||||
snippet artp "assert_redirected_to (path)"
|
||||
assert_redirected_to ${2:${12:model}_path(${13:@}${14:${12}})}
|
||||
assert_redirected_to ${2:${12:model}_path(${13:@}${14:$12})}
|
||||
endsnippet
|
||||
|
||||
snippet asrj "assert_rjs"
|
||||
@ -324,7 +324,7 @@ before_validation_on_update
|
||||
endsnippet
|
||||
|
||||
snippet bt "belongs_to (bt)"
|
||||
belongs_to :${1:object}${2:, :class_name => "${3:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}", :foreign_key => "${4:${1}_id}"}
|
||||
belongs_to :${1:object}${2:, :class_name => "${3:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}", :foreign_key => "${4:$1_id}"}
|
||||
endsnippet
|
||||
|
||||
snippet crw "cattr_accessor"
|
||||
@ -358,7 +358,7 @@ endsnippet
|
||||
snippet deftg "def get request"
|
||||
def test_should_get_${1:action}
|
||||
${2:@${3:model} = ${4:$3s}(:${5:fixture_name})
|
||||
}get :${1}${6:, :id => @$3.to_param}
|
||||
}get :$1${6:, :id => @$3.to_param}
|
||||
assert_response :success
|
||||
$0
|
||||
end
|
||||
@ -367,7 +367,7 @@ endsnippet
|
||||
snippet deftp "def post request"
|
||||
def test_should_post_${1:action}
|
||||
${3:@$2 = ${4:$2s}(:${5:fixture_name})
|
||||
}post :${1}${6:, :id => @$2.to_param}, :${2:model} => { $0 }
|
||||
}post :$1${6:, :id => @$2.to_param}, :${2:model} => { $0 }
|
||||
assert_response :redirect
|
||||
|
||||
end
|
||||
@ -400,23 +400,23 @@ end
|
||||
endsnippet
|
||||
|
||||
snippet habtm "has_and_belongs_to_many (habtm)"
|
||||
has_and_belongs_to_many :${1:object}${2:, :join_table => "${3:table_name}", :foreign_key => "${4:${1}_id}"}
|
||||
has_and_belongs_to_many :${1:object}${2:, :join_table => "${3:table_name}", :foreign_key => "${4:$1_id}"}
|
||||
endsnippet
|
||||
|
||||
snippet hm "has_many (hm)"
|
||||
has_many :${1:object}s${2:, :class_name => "${1}", :foreign_key => "${4:reference}_id"}
|
||||
has_many :${1:object}s${2:, :class_name => "$1", :foreign_key => "${4:reference}_id"}
|
||||
endsnippet
|
||||
|
||||
snippet hmt "has_many (through)"
|
||||
has_many :${1:objects}, :through => :${2:join_association}${3:, :source => :${4:${2}_table_foreign_key_to_${1}_table}}
|
||||
has_many :${1:objects}, :through => :${2:join_association}${3:, :source => :${4:$2_table_foreign_key_to_$1_table}}
|
||||
endsnippet
|
||||
|
||||
snippet hmd "has_many :dependent => :destroy"
|
||||
has_many :${1:object}s${2:, :class_name => "${1}", :foreign_key => "${4:reference}_id"}, :dependent => :destroy$0
|
||||
has_many :${1:object}s${2:, :class_name => "$1", :foreign_key => "${4:reference}_id"}, :dependent => :destroy$0
|
||||
endsnippet
|
||||
|
||||
snippet ho "has_one (ho)"
|
||||
has_one :${1:object}${2:, :class_name => "${3:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}", :foreign_key => "${4:${1}_id}"}
|
||||
has_one :${1:object}${2:, :class_name => "${3:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}", :foreign_key => "${4:$1_id}"}
|
||||
endsnippet
|
||||
|
||||
snippet logd "logger.debug"
|
||||
@ -514,11 +514,11 @@ redirect_to :controller => "${1:items}", :action => "${2:show}", :id => ${0:@ite
|
||||
endsnippet
|
||||
|
||||
snippet renpp "redirect_to (nested path plural)"
|
||||
redirect_to(${2:${10:parent}_${11:child}_path(${12:@}${13:${10}})})
|
||||
redirect_to(${2:${10:parent}_${11:child}_path(${12:@}${13:$10})})
|
||||
endsnippet
|
||||
|
||||
snippet renp "redirect_to (nested path)"
|
||||
redirect_to(${2:${12:parent}_${13:child}_path(${14:@}${15:${12}}, ${16:@}${17:${13}})})
|
||||
redirect_to(${2:${12:parent}_${13:child}_path(${14:@}${15:$12}, ${16:@}${17:$13})})
|
||||
endsnippet
|
||||
|
||||
snippet repp "redirect_to (path plural)"
|
||||
@ -526,7 +526,7 @@ redirect_to(${2:${10:model}s_path})
|
||||
endsnippet
|
||||
|
||||
snippet rep "redirect_to (path)"
|
||||
redirect_to(${2:${12:model}_path(${13:@}${14:${12}})})
|
||||
redirect_to(${2:${12:model}_path(${13:@}${14:$12})})
|
||||
endsnippet
|
||||
|
||||
snippet reb "redirect_to :back"
|
||||
@ -601,12 +601,6 @@ respond_to do |wants|
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet resw "respond_with"
|
||||
respond_with(${1:@${2:model}})${3: do |format|
|
||||
format.${4:html} { $0 \}
|
||||
end}
|
||||
endsnippet
|
||||
|
||||
# FIXME
|
||||
snippet returning "returning do |variable| ... end"
|
||||
returning ${1:variable} do${2/(^(?<var>\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1: |)/}${2:v}${2/(^(?<var>\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}
|
||||
@ -799,10 +793,6 @@ snippet xput "xhr put"
|
||||
xhr :put, :${1:update}, :id => ${2:1}, :${3:object} => { $4 }$0
|
||||
endsnippet
|
||||
|
||||
snippet finl "find(:last)"
|
||||
find(:last${1:, :conditions => ['${2:${3:field} = ?}', ${5:true}]})
|
||||
endsnippet
|
||||
|
||||
snippet sweeper "Create sweeper class"
|
||||
class ${1:Model}Sweeper < ActionController::Caching::Sweeper
|
||||
observe ${1:Model}
|
||||
@ -892,12 +882,12 @@ end
|
||||
endsnippet
|
||||
|
||||
snippet trans "Translation snippet"
|
||||
I18n.t('`!v substitute(substitute(substitute(@%, substitute(getcwd() . "/", "\/", "\\\\/", "g"), "", ""), "\\(\\.\\(html\\|js\\)\\.\\(haml\\|erb\\)\\|\\(_controller\\)\\?\\.rb\\)$", "", ""), "/", ".", "g")`.${2:${1/[^\w]/_/g}}${3}', :default => "${1:some_text}"${4})${5:$0}
|
||||
I18n.t('`!v substitute(substitute(substitute(@%, substitute(getcwd() . "/", "\/", "\\\\/", "g"), "", ""), "\\(\\.\\(html\\|js\\)\\.\\(haml\\|erb\\)\\|\\(_controller\\)\\?\\.rb\\)$", "", ""), "/", ".", "g")`.${2:${1/[^\w]/_/g}}$3', :default => "${1:some_text}"$4)${5:$0}
|
||||
endsnippet
|
||||
|
||||
snippet route_spec
|
||||
it 'routes to #${1:action}' do
|
||||
${2:get}('/${3:url}').should route_to('`!v substitute(expand('%:t:r'), '_routing_spec$', '', '')`#$1'${4:, ${5:params}})${6}
|
||||
${2:get}('/${3:url}').should route_to('`!v substitute(expand('%:t:r'), '_routing_spec$', '', '')`#$1'${4:, ${5:params}})$6
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
@ -28,7 +28,7 @@ SPECIFIC_ADMONITIONS = ["attention", "caution", "danger",
|
||||
#http://docutils.sourceforge.net/docs/ref/rst/directives.html
|
||||
DIRECTIVES = ['topic','sidebar','math','epigraph',
|
||||
'parsed-literal','code','highlights',
|
||||
'pull-quote','compound','container',
|
||||
'pull-quote','compound','container','table','csv-table',
|
||||
'list-table','class','sectnum',
|
||||
'role','default-role','unicode',
|
||||
'raw']
|
||||
@ -238,6 +238,7 @@ if di == 'im':
|
||||
if di == 'fi':
|
||||
content="""
|
||||
:alt: {0}
|
||||
|
||||
{0}""".format(real_name)
|
||||
`
|
||||
..`!p snip.rv = " %s" % link if link else ""` $1`!p
|
||||
@ -281,6 +282,23 @@ snippet ro "Text Roles" w
|
||||
path))`:\`$2\`\
|
||||
endsnippet
|
||||
|
||||
snippet eu "Embedded URI" i
|
||||
`!p
|
||||
if has_cjk(vim.current.line):
|
||||
snip.rv = "\ "`\`${1:${VISUAL:Text}} <${2:URI}>\`_`!p
|
||||
if has_cjk(vim.current.line):
|
||||
snip.rv ="\ "
|
||||
else:
|
||||
snip.rv = ""
|
||||
`$0
|
||||
endsnippet
|
||||
|
||||
snippet fnt "Footnote or Citation" i
|
||||
[${1:Label}]_ $0
|
||||
|
||||
.. [$1] ${2:Reference}
|
||||
endsnippet
|
||||
|
||||
############
|
||||
# Sphinx #
|
||||
############
|
||||
|
@ -1,271 +1,159 @@
|
||||
priority -50
|
||||
|
||||
#
|
||||
# Global functions
|
||||
#
|
||||
|
||||
global !p
|
||||
|
||||
def write_instance_vars(arglist, snip):
|
||||
args = str(arglist).split(',')
|
||||
for arg in args:
|
||||
name = arg.strip().replace(':', ' ').split(' ', 1)[0]
|
||||
if name:
|
||||
snip += ' @{} = {}'.format(name, name)
|
||||
else:
|
||||
snip += ''
|
||||
|
||||
endglobal
|
||||
|
||||
#
|
||||
# Snippets
|
||||
#
|
||||
|
||||
snippet "^#!" "#!/usr/bin/env ruby" r
|
||||
#!/usr/bin/env ruby
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet "^# ?[uU][tT][fF]-?8" "# encoding: UTF-8" r
|
||||
# encoding: UTF-8
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet If "<command> if <expression>"
|
||||
${1:command} if ${0:expression}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet Unless "<command> unless <expression>"
|
||||
${1:command} unless ${0:expression}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet if "if <condition> ... end"
|
||||
if ${1:condition}
|
||||
${2:# TODO}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet ife "if <condition> ... else ... end"
|
||||
if ${1:condition}
|
||||
${2:# TODO}
|
||||
else
|
||||
${3:# TODO}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet ifee "if <condition> ... elseif <condition> ... else ... end"
|
||||
if ${1:condition}
|
||||
${2:# TODO}
|
||||
elsif ${3:condition}
|
||||
${4:# TODO}
|
||||
else
|
||||
${0:# TODO}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet unless "unless <condition> ... end"
|
||||
unless ${1:condition}
|
||||
${0:# TODO}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet unlesse "unless <condition> ... else ... end"
|
||||
unless ${1:condition}
|
||||
${2:# TODO}
|
||||
else
|
||||
${0:# TODO}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet unlesee "unless <condition> ... elseif <condition> ... else ... end"
|
||||
unless ${1:condition}
|
||||
${2:# TODO}
|
||||
elsif ${3:condition}
|
||||
${4:# TODO}
|
||||
else
|
||||
${0:# TODO}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "\b(de)?f" "def <name>..." r
|
||||
def ${1:function_name}${2: ${3:*args}}
|
||||
${0:# TODO}
|
||||
def ${1:function_name}${2:(${3:*args})}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet defi "def initialize ..."
|
||||
def initialize${1: ${2:*args}}
|
||||
${0:# TODO}
|
||||
def initialize($1)`!p write_instance_vars(t[1],snip)`$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet defr "def <name> ... rescue ..."
|
||||
def ${1:function_name}${2: ${3:*args}}
|
||||
${4:# TODO}
|
||||
def ${1:function_name}${2:(${3:*args})}
|
||||
$4
|
||||
rescue
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet For "(<from>..<to>).each { |<i>| <block> }"
|
||||
(${1:from}..${2:to}).each { |${3:i}| ${4:# TODO} }
|
||||
(${1:from}..${2:to}).each { |${3:i}| $0 }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet for "(<from>..<to>).each do |<i>| <block> end"
|
||||
(${1:from}..${2:to}).each do |${3:i}|
|
||||
${0:# TODO}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Merge!" ".merge!(<other_hash>) { |<key>,<oldval>,<newval>| <block> }" r
|
||||
`!p snip.rv=match.group(1)`.merge!(${1:other_hash}) { |${2:key},${3:oldval},${4:newval}| ${5:block} }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.merge!" ".merge!(<other_hash>) do |<key>,<oldval>,<newval>| <block> end" r
|
||||
`!p snip.rv=match.group(1)`.merge!(${1:other_hash}) do |${2:key},${3:oldval},${4:newval}|
|
||||
${0:block}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Del(ete)?_?if" ".delete_if { |<key>,<value>| <block> }" r
|
||||
`!p snip.rv=match.group(1)`.delete_if { |${1:key},${2:value}| ${3:# TODO} }
|
||||
`!p snip.rv=match.group(1)`.delete_if { |${1:key},${2:value}| $0 }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.del(ete)?_?if" ".delete_if do |<key>,<value>| <block> end" r
|
||||
`!p snip.rv=match.group(1)`.delete_if do |${1:key},${2:value}|
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Keep_?if" ".keep_if { |<key>,<value>| <block> }" r
|
||||
`!p snip.rv=match.group(1)`.keep_if { |${1:key},${2:value}| ${3:# TODO} }
|
||||
`!p snip.rv=match.group(1)`.keep_if { |${1:key},${2:value}| $0 }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.keep_?if" ".keep_if do <key>,<value>| <block> end" r
|
||||
`!p snip.rv=match.group(1)`.keep_if do |${1:key},${2:value}|
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Reject" ".reject { |<key>,<value>| <block> }" r
|
||||
`!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| ${3:# TODO} }
|
||||
`!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| $0 }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.reject" ".reject do <key>,<value>| <block> end" r
|
||||
`!p snip.rv=match.group(1)`.reject do |${1:key},${2:value}|
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Select" ".select { |<item>| <block>}" r
|
||||
`!p snip.rv=match.group(1)`.select { |${1:item}| ${2:block} }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.select" ".select do |<item>| <block> end" r
|
||||
`!p snip.rv=match.group(1)`.select do |${1:item}|
|
||||
${0:block}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Sort" ".sort { |<a>,<b>| <block> }" r
|
||||
`!p snip.rv=match.group(1)`.sort { |${1:a},${2:b}| ${3:# TODO} }
|
||||
`!p snip.rv=match.group(1)`.sort { |${1:a},${2:b}| $0 }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.sort" ".sort do |<a>,<b>| <block> end" r
|
||||
`!p snip.rv=match.group(1)`.sort do |${1:a},${2:b}|
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Each_?k(ey)?" ".each_key { |<key>| <block> }" r
|
||||
`!p snip.rv=match.group(1)`.each_key { |${1:key}| ${2:# TODO} }
|
||||
`!p snip.rv=match.group(1)`.each_key { |${1:key}| $0 }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.each_?k(ey)?" ".each_key do |key| <block> end" r
|
||||
`!p snip.rv=match.group(1)`.each_key do |${1:key}|
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Each_?val(ue)?" ".each_value { |<value>| <block> }" r
|
||||
`!p snip.rv=match.group(1)`.each_value { |${1:value}| ${2:# TODO} }
|
||||
`!p snip.rv=match.group(1)`.each_value { |${1:value}| $0 }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.each_?val(ue)?" ".each_value do |<value>| <block> end" r
|
||||
`!p snip.rv=match.group(1)`.each_value do |${1:value}|
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet Each "<elements>.each { |<element>| <block> }"
|
||||
${1:elements}.each { |${2:${1/s$//}}| ${3:# TODO} }
|
||||
snippet "(\S+)\.ea" "<elements>.each do |<element>| <block> end" r
|
||||
`!p snip.rv=match.group(1)`.each { |${1:e}| $0 }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet each "<elements>.each do |<element>| <block> end"
|
||||
${1:elements}.each do |${2:${1/s$//}}|
|
||||
${0:# TODO}
|
||||
snippet "(\S+)\.ead" "<elements>.each do |<element>| <block> end" r
|
||||
`!p snip.rv=match.group(1)`.each do |${1:e}|
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "each_?s(lice)?" "<array>.each_slice(n) do |slice| <block> end" r
|
||||
${1:elements}.each_slice(${2:2}) do |${3:slice}|
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "Each_?s(lice)?" "<array>.each_slice(n) { |slice| <block> }" r
|
||||
${1:elements}.each_slice(${2:2}) { |${3:slice}| ${0:# TODO} }
|
||||
${1:elements}.each_slice(${2:2}) { |${3:slice}| $0 }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Map" ".map { |<element>| <block> }" r
|
||||
`!p snip.rv=match.group(1)`.map { |${1:`!p
|
||||
element_name = match.group(1).lstrip('$@')
|
||||
@ -275,11 +163,9 @@ try:
|
||||
snip.rv = wmatch.group(1).lower()
|
||||
except:
|
||||
snip.rv = 'element'
|
||||
`}| ${2:# TODO} }
|
||||
`}| $0 }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.map" ".map do |<element>| <block> end" r
|
||||
`!p snip.rv=match.group(1)`.map do |${1:`!p
|
||||
element_name = match.group(1).lstrip('$@')
|
||||
@ -290,12 +176,10 @@ try:
|
||||
except:
|
||||
snip.rv = 'element'
|
||||
`}|
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Rev(erse)?_?each" ".reverse_each { |<element>| <block> }" r
|
||||
`!p snip.rv=match.group(1)`.reverse_each { |${1:`!p
|
||||
element_name = match.group(1).lstrip('$@')
|
||||
@ -305,11 +189,9 @@ try:
|
||||
snip.rv = wmatch.group(1).lower()
|
||||
except:
|
||||
snip.rv = 'element'
|
||||
`}| ${2:# TODO} }
|
||||
`}| $0 }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.rev(erse)?_?each" ".reverse_each do |<element>| <block> end" r
|
||||
`!p snip.rv=match.group(1)`.reverse_each do |${1:`!p
|
||||
element_name = match.group(1).lstrip('$@')
|
||||
@ -320,12 +202,10 @@ try:
|
||||
except:
|
||||
snip.rv = 'element'
|
||||
`}|
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Each" ".each { |<element>| <block> }" r
|
||||
`!p snip.rv=match.group(1)`.each { |${1:`!p
|
||||
element_name = match.group(1).lstrip('$@')
|
||||
@ -335,11 +215,9 @@ try:
|
||||
snip.rv = wmatch.group(1).lower()
|
||||
except:
|
||||
snip.rv = 'element'
|
||||
`}| ${2:# TODO} }
|
||||
`}| $0 }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.each" ".each do |<element>| <block> end" r
|
||||
`!p snip.rv=match.group(1)`.each do |${1:`!p
|
||||
element_name = match.group(1).lstrip('$@')
|
||||
@ -350,175 +228,70 @@ try:
|
||||
except:
|
||||
snip.rv = 'element'
|
||||
`}|
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Each_?w(ith)?_?i(ndex)?" ".each_with_index { |<element>,<i>| <block> }" r
|
||||
`!p snip.rv=match.group(1)`.each_with_index { |${1:`!p
|
||||
element_name = match.group(1).lstrip('$@')
|
||||
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
||||
try:
|
||||
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
||||
snip.rv = wmatch.group(1).lower()
|
||||
except:
|
||||
snip.rv = 'element'
|
||||
`},${2:i}| ${3:# TODO} }$0
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.each_?w(ith)?_?i(ndex)?" ".each_with_index do |<element>,<i>| <block> end" r
|
||||
`!p snip.rv=match.group(1)`.each_with_index do |${1:`!p
|
||||
element_name = match.group(1).lstrip('$@')
|
||||
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
||||
try:
|
||||
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
||||
snip.rv = wmatch.group(1).lower()
|
||||
except:
|
||||
snip.rv = 'element'
|
||||
`},${2:i}|
|
||||
${0:# TODO}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Each_?p(air)?" ".each_pair { |<key>,<value>| <block> }" r
|
||||
`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| ${3:# TODO} }
|
||||
`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| $0 }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.each_?p(air)?" ".each_pair do |<key>,<value>| <block> end" r
|
||||
`!p snip.rv=match.group(1)`.each_pair do |${1:key},${2:value}|
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.sub" ".sub(<expression>) { <block> }" r
|
||||
`!p snip.rv=match.group(1)`.sub(${1:expression}) { ${2:"replace_with"} }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.gsub" ".gsub(<expression>) { <block> }" r
|
||||
`!p snip.rv=match.group(1)`.gsub(${1:expression}) { ${2:"replace_with"} }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.index" ".index { |item| <block> }" r
|
||||
`!p snip.rv=match.group(1)`.index { |${1:item}| ${2:block} }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Index" ".index do |item| ... end" r
|
||||
`!p snip.rv=match.group(1)`.index do |${1:item}|
|
||||
${0:block}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet do "do |<key>| ... end" i
|
||||
do |${1:args}|
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet Do "do ... end" i
|
||||
do
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet until "until <expression> ... end"
|
||||
until ${1:expression}
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet Until "begin ... end until <expression>"
|
||||
begin
|
||||
${0:# TODO}
|
||||
$0
|
||||
end until ${1:expression}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet while "while <expression> ... end"
|
||||
while ${1:expression}
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet While "begin ... end while <expression>"
|
||||
begin
|
||||
${0:# TODO}
|
||||
$0
|
||||
end while ${1:expression}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "\b(r|attr)" "attr_reader :<attr_names>" r
|
||||
attr_reader :${0:attr_names}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "\b(w|attr)" "attr_writer :<attr_names>" r
|
||||
attr_writer :${0:attr_names}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "\b(rw|attr)" "attr_accessor :<attr_names>" r
|
||||
attr_accessor :${0:attr_names}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet begin "begin ... rescue ... end"
|
||||
begin
|
||||
${1:# TODO}
|
||||
$1
|
||||
rescue
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet begin "begin ... rescue ... else ... ensure ... end"
|
||||
begin
|
||||
${1:# Raise exception}
|
||||
rescue Exception => e
|
||||
puts e.message
|
||||
puts e.backtrace.inspect
|
||||
${2:# Rescue}
|
||||
else
|
||||
${3:# other exception}
|
||||
ensure
|
||||
${0:# always excute}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet rescue
|
||||
rescue Exception => e
|
||||
puts e.message
|
||||
@ -526,8 +299,6 @@ rescue Exception => e
|
||||
${0:# Rescue}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "\b(case|sw(itch)?)" "case <variable> when <expression> ... end" r
|
||||
case ${1:variable}
|
||||
when ${2:expression}
|
||||
@ -535,32 +306,20 @@ $0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet alias "alias :<new_name> :<old_name>"
|
||||
alias :${1:new_name} :${2:old_name}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet class "class <class_name> def initialize ... end end"
|
||||
class ${1:class_name}
|
||||
def initialize ${2:*args}
|
||||
def initialize(${2:*args})
|
||||
$0
|
||||
end
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet module "module"
|
||||
module ${1:module_name}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet ###
|
||||
=begin
|
||||
$0
|
||||
|
@ -4,249 +4,103 @@
|
||||
|
||||
priority -50
|
||||
|
||||
snippet fn "A function, optionally with arguments and return type." b
|
||||
fn ${1:function_name}(${2})${3/..*/ -> /}${3} {
|
||||
${VISUAL}${0}
|
||||
snippet let "let variable declaration" b
|
||||
let ${1:name}${2:: ${3:type}} = $4;
|
||||
endsnippet
|
||||
|
||||
snippet letm "let mut variable declaration" b
|
||||
let mut ${1:name}${2:: ${3:type}} = $4;
|
||||
endsnippet
|
||||
|
||||
snippet fn "A function, optionally with arguments and return type."
|
||||
fn ${1:function_name}($2)${3/..*/ -> /}$3 {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet test "Test function" b
|
||||
#[test]
|
||||
fn ${1:test_function_name}() {
|
||||
${VISUAL}${0}
|
||||
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
|
||||
|
||||
snippet bench "Bench function" b
|
||||
#[bench]
|
||||
fn ${1:bench_function_name}(b: &mut test::Bencher) {
|
||||
b.iter(|| {
|
||||
${VISUAL}${0}
|
||||
})
|
||||
snippet || "Closure, anonymous function (inline)" i
|
||||
${1:move }|$2| { $3 }
|
||||
endsnippet
|
||||
|
||||
snippet |} "Closure, anonymous function (block)" i
|
||||
${1:move }|$2| {
|
||||
$3
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet new "A new function" b
|
||||
pub fn new(${2}) -> ${1:Name} {
|
||||
${VISUAL}${0}return $1 { ${3} };
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet main "The main function" b
|
||||
pub fn main() {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet let "A let statement" b
|
||||
let ${1:name}${3} = ${VISUAL}${2};
|
||||
endsnippet
|
||||
|
||||
snippet lmut "let mut = .." b
|
||||
let mut ${1:name}${3} = ${VISUAL}${2};
|
||||
endsnippet
|
||||
|
||||
snippet pri "print!(..)" b
|
||||
print!("${1}"${2/..*/, /}${2});
|
||||
print!("$1"${2/..*/, /}$2);
|
||||
endsnippet
|
||||
|
||||
snippet pln "println!(..)" b
|
||||
println!("${1}"${2/..*/, /}${2});
|
||||
println!("$1"${2/..*/, /}$2);
|
||||
endsnippet
|
||||
|
||||
snippet fmt "format!(..)"
|
||||
format!("${1}"${2/..*/, /}${2});
|
||||
format!("$1"${2/..*/, /}$2);
|
||||
endsnippet
|
||||
|
||||
snippet macro "macro_rules!" b
|
||||
macro_rules! ${1:name} (
|
||||
macro_rules! ${1:name} {
|
||||
(${2:matcher}) => (
|
||||
${3}
|
||||
$3
|
||||
)
|
||||
)
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ec "extern crate ..." b
|
||||
extern crate ${1:sync};
|
||||
endsnippet
|
||||
|
||||
snippet ecl "...extern crate log;" b
|
||||
#![feature(phase)]
|
||||
#[phase(plugin, link)] extern crate log;
|
||||
endsnippet
|
||||
|
||||
snippet mod "A module" b
|
||||
snippet mod "A module" b
|
||||
mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet crate "Create header information" b
|
||||
// Crate name
|
||||
#![crate_name = "${1:crate_name}"]
|
||||
|
||||
// Additional metadata attributes
|
||||
#![desc = "${2:Descrption.}"]
|
||||
#![license = "${3:BSD}"]
|
||||
#![comment = "${4:Comment.}"]
|
||||
|
||||
// Specify the output type
|
||||
#![crate_type = "${5:lib}"]
|
||||
endsnippet
|
||||
|
||||
snippet allow "#[allow(..)]" b
|
||||
#[allow(${1:unused_variable})]
|
||||
endsnippet
|
||||
|
||||
snippet feat "#![feature(..)]" b
|
||||
#![feature(${1:macro_rules})]
|
||||
endsnippet
|
||||
|
||||
snippet der "#[deriving(..)]" b
|
||||
#[deriving(${1:Show})]
|
||||
endsnippet
|
||||
|
||||
snippet attr "#[..]" b
|
||||
#[${1:inline}]
|
||||
endsnippet
|
||||
|
||||
snippet opt "Option<..>"
|
||||
Option<${1:int}>
|
||||
endsnippet
|
||||
|
||||
snippet res "Result<.., ..>"
|
||||
Result<${1:int}, ${2:()}>
|
||||
endsnippet
|
||||
|
||||
snippet if "if .. (if)" b
|
||||
if ${1} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet el "else .. (el)"
|
||||
else {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet eli "else if .. (eli)"
|
||||
else if ${1} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ife "if .. else (ife)"
|
||||
if ${1} {
|
||||
${2}
|
||||
} else {
|
||||
${3}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet mat "match"
|
||||
match ${1} {
|
||||
${2} => ${3},
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet loop "loop {}" b
|
||||
loop {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet while "while .. {}" b
|
||||
while ${1} {
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "for .. in .." b
|
||||
for ${1:i} in ${2:range(0u, 10)} {
|
||||
${VISUAL}${0}
|
||||
for ${1:i} in $2 {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet spawn "spawn(proc() { .. });" b
|
||||
spawn(proc() {
|
||||
${VISUAL}${0}
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet chan "A channel" b
|
||||
let (${1:tx}, ${2:rx}): (Sender<${3:int}>, Receiver<${4:int}>) = channel();
|
||||
endsnippet
|
||||
|
||||
snippet duplex "Duplex stream" b
|
||||
let (${1:from_child}, ${2:to_child}) = sync::duplex();
|
||||
endsnippet
|
||||
|
||||
snippet todo "A Todo comment"
|
||||
// [TODO]: ${1:Description} - `!v strftime("%Y-%m-%d %I:%M%P")`
|
||||
endsnippet
|
||||
|
||||
snippet fixme "FIXME comment"
|
||||
// FIXME: ${1}
|
||||
endsnippet
|
||||
|
||||
snippet st "Struct" b
|
||||
struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# TODO: fancy dynamic field mirroring like Python slotclass
|
||||
snippet stn "Struct with new constructor." b
|
||||
pub struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
|
||||
${3}
|
||||
fd$0
|
||||
}
|
||||
|
||||
impl $1 {
|
||||
pub fn new(${2}) -> $1 {
|
||||
${4}return $1 {
|
||||
${5}
|
||||
};
|
||||
pub fn new($2) -> $1 {
|
||||
$1 { $3 }
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet enum "An enum" b
|
||||
enum ${1:Name} {
|
||||
${VISUAL}${0},
|
||||
snippet fd "Struct field definition" w
|
||||
${1:name}: ${2:Type},
|
||||
endsnippet
|
||||
|
||||
snippet impl "Struct/Trait implementation" b
|
||||
impl ${1:Type/Trait}${2: for ${3:Type}} {
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet type "A type" b
|
||||
type ${1:NewName} = ${VISUAL}${0};
|
||||
endsnippet
|
||||
|
||||
snippet imp "An impl" b
|
||||
impl ${1:Name} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet drop "Drop implementation" b
|
||||
impl Drop for ${1:Name} {
|
||||
fn drop(&mut self) {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet trait "Trait definition" b
|
||||
trait ${1:Name} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ss "A static string."
|
||||
static ${1}: &'static str = "${VISUAL}${0}";
|
||||
endsnippet
|
||||
|
||||
snippet stat "A static variable."
|
||||
static ${1}: ${2:uint} = ${VISUAL}${0};
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -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
|
@ -33,6 +33,13 @@ snippet !env "#!/usr/bin/env (!env)"
|
||||
`!p snip.rv = '#!/usr/bin/env ' + getShell() + "\n\n" `
|
||||
endsnippet
|
||||
|
||||
snippet sbash "safe bash options"
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
`!p snip.rv ='\n\n' `
|
||||
endsnippet
|
||||
|
||||
snippet temp "Tempfile"
|
||||
${1:TMPFILE}="$(mktemp -t ${2:`!p
|
||||
snip.rv = re.sub(r'[^a-zA-Z]', '_', snip.fn) or "untitled"
|
||||
|
@ -2,15 +2,15 @@ priority -50
|
||||
|
||||
# We use a little hack so that the snippet is expanded
|
||||
# and parsed correctly
|
||||
snippet snip "Snippet definition" b
|
||||
snippet usnip "Ultisnips snippet definition" b
|
||||
`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:b}
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
`!p snip.rv = "endsnippet"`
|
||||
endsnippet
|
||||
|
||||
snippet global "Global snippet" b
|
||||
`!p snip.rv = "global"` !p
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
`!p snip.rv = "endglobal"`
|
||||
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
|
@ -5,21 +5,21 @@ priority -50
|
||||
###########################################################################
|
||||
snippet for "for... (for)" b
|
||||
for {${1:set i 0}} {${2:\$i < \$n}} {${3:incr i}} {
|
||||
${4}
|
||||
$4
|
||||
}
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet foreach "foreach... (foreach)"
|
||||
foreach ${1:var} ${2:\$list} {
|
||||
${3}
|
||||
$3
|
||||
}
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet if "if... (if)" b
|
||||
if {${1:condition}} {
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
|
||||
endsnippet
|
||||
@ -27,7 +27,7 @@ endsnippet
|
||||
snippet proc "proc... (proc)" b
|
||||
proc ${1:name} {${2:args}} \
|
||||
{
|
||||
${3}
|
||||
$3
|
||||
}
|
||||
|
||||
endsnippet
|
||||
@ -35,16 +35,16 @@ endsnippet
|
||||
snippet switch "switch... (switch)" b
|
||||
switch ${1:-exact} -- ${2:\$var} {
|
||||
${3:match} {
|
||||
${4}
|
||||
$4
|
||||
}
|
||||
default {${5}}
|
||||
default {$5}
|
||||
}
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet while "while... (while)" b
|
||||
while {${1:condition}} {
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
|
||||
endsnippet
|
||||
|
@ -10,10 +10,21 @@ endsnippet
|
||||
|
||||
snippet tab "tabular / array environment" b
|
||||
\begin{${1:t}${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${2:c}}
|
||||
$0${2/((?<=.)c|l|r)|./(?1: & )/g}
|
||||
$0${2/(?<=.)(c|l|r)|./(?1: & )/g}
|
||||
\end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}
|
||||
endsnippet
|
||||
|
||||
snippet table "Table environment" b
|
||||
\begin{table}[${1:htpb}]
|
||||
\centering
|
||||
\caption{${2:caption}}
|
||||
\label{tab:${3:label}}
|
||||
\begin{${4:t}${4/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${5:c}}
|
||||
$0${5/(?<=.)(c|l|r)|./(?1: & )/g}
|
||||
\end{$4${4/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}
|
||||
\end{table}
|
||||
endsnippet
|
||||
|
||||
snippet fig "Figure environment" b
|
||||
\begin{figure}[${2:htpb}]
|
||||
\centering
|
||||
@ -42,7 +53,7 @@ snippet desc "Description" b
|
||||
endsnippet
|
||||
|
||||
snippet it "Individual item" b
|
||||
\item ${1}
|
||||
\item $1
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
@ -50,54 +61,54 @@ snippet part "Part" b
|
||||
\part{${1:part name}}
|
||||
\label{prt:${2:${1/(\w+)|\W+/(?1:\L$0\E:_)/ga}}}
|
||||
|
||||
${0}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet cha "Chapter" b
|
||||
\chapter{${1:chapter name}}
|
||||
\label{cha:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet sec "Section" b
|
||||
\section{${1:section name}}
|
||||
\label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet sub "Subsection" b
|
||||
\subsection{${1:subsection name}}
|
||||
\label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ssub "Subsubsection" b
|
||||
\subsubsection{${1:subsubsection name}}
|
||||
\label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet par "Paragraph" b
|
||||
\paragraph{${1:paragraph name}}
|
||||
\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet subp "Subparagraph" b
|
||||
\subparagraph{${1:subparagraph name}}
|
||||
\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ni "Non-indented paragraph" b
|
||||
\noindent
|
||||
${0}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet pac "Package" b
|
||||
|
@ -1,35 +0,0 @@
|
||||
priority -50
|
||||
|
||||
snippet bl "twig block" b
|
||||
{% block ${1} %}
|
||||
${2}
|
||||
{% endblock $1 %}
|
||||
endsnippet
|
||||
|
||||
snippet js "twig javascripts" b
|
||||
{% javascripts '${1}' %}
|
||||
<script src="{{ asset_url }}"></script>
|
||||
{% endjavascripts %}
|
||||
endsnippet
|
||||
|
||||
snippet css "twig stylesheets" b
|
||||
{% stylesheets '${1}' %}
|
||||
<link rel="stylesheet" href="{{ asset_url }}">
|
||||
{% endstylesheets %}
|
||||
endsnippet
|
||||
|
||||
snippet if "twig if" b
|
||||
{% if ${1} %}
|
||||
${2}
|
||||
{% endif %}
|
||||
endsnippet
|
||||
|
||||
snippet for "twig for" b
|
||||
{% for ${1} in ${2} %}
|
||||
${3}
|
||||
{% endfor %}
|
||||
endsnippet
|
||||
|
||||
snippet ext "twig extends" b
|
||||
{% extends ${1} %}
|
||||
endsnippet
|
@ -0,0 +1,3 @@
|
||||
priority -50
|
||||
|
||||
extends javascript
|
@ -13,11 +13,11 @@ snippet guard "script reload guard" b
|
||||
if exists('${1:did_`!p snip.rv = snip.fn.replace('.','_')`}') || &cp${2: || version < 700}
|
||||
finish
|
||||
endif
|
||||
let $1 = 1${3}
|
||||
let $1 = 1$3
|
||||
endsnippet
|
||||
|
||||
snippet f "function" b
|
||||
fun ${1:function_name}(${2})
|
||||
fun ${1:function_name}($2)
|
||||
${3:" code}
|
||||
endf
|
||||
endsnippet
|
||||
|
Reference in New Issue
Block a user