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

Updated plugins. Removed the tabstop merge that 010c2940ce introduced

This commit is contained in:
amix
2014-10-14 14:30:33 +01:00
parent d283422444
commit fe77d23852
99 changed files with 1142 additions and 359 deletions

View File

@ -19,7 +19,49 @@ config(function($1) {
endsnippet
snippet acont "angular controller" i
controller('${1:name}', function($2) {
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

View File

@ -9,7 +9,7 @@ snippet /* "A JSDoc comment" b
endsnippet
snippet @au "@author email (First Last)"
@author ${1:`!v g:snips_author_email`} (${2:`!v g:snips_author`})
@author ${1:`!v g:snips_author`} [${2:`!v g:snips_author_email`}]
endsnippet
snippet @li "@license Description"

View File

@ -145,49 +145,79 @@ $0
endsnippet
snippet pub "Public function" b
/**
* ${3:undocumented function}
*
* @return ${4:void}
*/
public function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
${VISUAL}${5:return null;}
}
$0
endsnippet
snippet pro "Protected function" b
/**
* ${3:undocumented function}
*
* @return ${4:void}
*/
protected function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
${VISUAL}${5:return null;}
}
$0
endsnippet
snippet pri "Private function" b
/**
* ${3:undocumented function}
*
* @return ${4:void}
*/
private function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
${VISUAL}${5:return null;}
}
$0
endsnippet
snippet pubs "Public static function" b
/**
* ${3:undocumented function}
*
* @return ${4:void}
*/
public static function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
${VISUAL}${5:return null;}
}
$0
endsnippet
snippet pros "Protected static function" b
/**
* ${3:undocumented function}
*
* @return ${4:void}
*/
protected static function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
${VISUAL}${5:return null;}
}
$0
endsnippet
snippet pris "Private static function" b
/**
* ${3:undocumented function}
*
* @return ${4:void}
*/
private static function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
${VISUAL}${5:return null;}
}
$0
endsnippet
@ -223,10 +253,25 @@ endsnippet
snippet class "Class declaration template" b
/**
* Class ${1:`!p snip.rv=snip.fn.split('.')[0]`}
* Class ${2:`!p snip.rv=snip.fn.split('.')[0]`}
* @author ${3:`!v g:snips_author`}
*/
$1class $2
{
public function ${4:__construct}(${5:$options})
{
${6:// code}
}
}
$0
endsnippet
snippet interface "interface declaration template" b
/**
* Interface ${1:`!p snip.rv=snip.fn.split('.')[0]`}
* @author ${2:`!v g:snips_author`}
*/
class $1
interface $1
{
public function ${3:__construct}(${4:$options})
{
@ -267,4 +312,10 @@ public function $1Action($2)
}
endsnippet
snippet inheritdoc "@inheritdoc docblock"
/**
* {@inheritdoc}
*/
endsnippet
# :vim:ft=snippets:

View File

@ -157,6 +157,26 @@ def write_slots_args(args, snip):
args = ['"_%s"' % arg for arg in args]
snip += '__slots__ = (%s,)' % ', '.join(args)
def write_function_docstring(t, snip):
"""
Writes a function docstring with the current style.
:param t: The values of the placeholders
:param snip: UltiSnips.TextObjects.SnippetUtil object instance
"""
snip.rv = ""
snip >> 1
args = get_args(t[2])
if args:
write_docstring_args(args, snip)
style = get_style(snip)
snip += format_return(style)
snip.rv += '\n' + snip.mkline('', indent='')
snip += triple_quotes(snip)
endglobal
########################################
@ -400,17 +420,27 @@ 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
snip.rv = ""
snip >> 1
write_function_docstring(t, snip) `
${0:pass}
endsnippet
args = get_args(t[2])
if args:
write_docstring_args(args, snip)
style = get_style(snip)
snip += format_return(style)
snip.rv += '\n' + snip.mkline('', indent='')
snip += triple_quotes(snip) `
snippet defc "class method with docstrings" b
@classmethod
def ${1:function}(`!p
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}
endsnippet
snippet defs "static method with docstrings" b
@staticmethod
def ${1:function}(${2:arg1}):
`!p snip.rv = triple_quotes(snip)`${4:TODO: Docstring for $1.}`!p
write_function_docstring(t, snip) `
${0:pass}
endsnippet

View File

@ -7,21 +7,21 @@ snippet imp "@import '...';" b
endsnippet
snippet inc "@include mixin(...);" b
@include ${1:mixin}(${2:arguments});
@include ${1:mixin}(${2});
endsnippet
snippet ext "@extend %placeholder;" b
@extend %${1:placeholder};
@extend %${1:%placeholder};
endsnippet
snippet mixin "@mixin (...) { ... }" b
@mixin ${1:name}(${2:arguments}) {
@mixin ${1:name}(${2}) {
${VISUAL}$0
}
endsnippet
snippet fun "@function (...) { ... }" b
@function ${1:name}(${2:arguments}) {
@function ${1:name}(${2}) {
${VISUAL}$0
}
endsnippet

View File

@ -15,7 +15,7 @@ $0${2/((?<=.)c|l|r)|./(?1: & )/g}
endsnippet
snippet fig "Figure environment" b
\begin{figure}${2:[htpb]}
\begin{figure}[${2:htpb}]
\centering
\includegraphics[width=${3:0.8}\linewidth]{${4:name.ext}}
\caption{${4/(\w+)\.\w+/\u$1/}$0}