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}

View File

@ -127,3 +127,5 @@ snippet ife
<% else %>
${0}
<% end %>
snippet pry
<% require 'pry'; binding.pry %>

View File

@ -3,7 +3,7 @@ snippet ex
module.exports = ${1};
# require
snippet re
var ${1} = require("${2:module_name}");
var ${1} = require('${2:module_name}');
# EventEmitter
snippet on
on('${1:event_name}', function(${2:stream}) {
@ -47,4 +47,3 @@ snippet stdout
process.stdout
snippet stderr
process.stderr

View File

@ -1,3 +1,5 @@
# Functions
# prototype
snippet proto
${1:class_name}.prototype.${2:method_name} = function(${3}) {
@ -23,6 +25,18 @@ snippet (f
(function(${1}) {
${0}
}(${2}));
# self-defining function
snippet sdf
var ${1:function_name} = function (${2:argument}) {
${3}
$1 = function ($2) {
${0}
};
};
# Flow control
# if
snippet if
if (${1:true}) {
@ -37,7 +51,7 @@ snippet ife
}
# tertiary conditional
snippet ter
${1:/* condition */} ? ${2:a} : ${0:b}
${1:/* condition */} ? ${2:/* if true */} : ${0:/* if false */}
# switch
snippet switch
switch (${1:expression}) {
@ -54,21 +68,6 @@ snippet case
${2}
break;
${0}
# for (...) {...}
snippet for
for (var ${2:i} = 0, l = ${1:arr}.length; $2 < l; $2 ++) {
var ${3:v} = $1[$2];${0:}
}
# for (...) {...} (Improved Native For-Loop)
snippet forr
for (var ${2:i} = ${1:arr}.length - 1; $2 >= 0; $2 --) {
var ${3:v} = $1[$2];${0:}
}
# while (...) {...}
snippet wh
while (${1:/* condition */}) {
${0}
}
# try
snippet try
try {
@ -76,67 +75,48 @@ snippet try
} catch (${2:e}) {
${0:/* handle error */}
}
# do...while
# return
snippet ret
return ${0:result};
# Loops
# for loop
snippet for
for (var ${2:i} = 0, l = ${1:arr}.length; $2 < l; $2 ++) {
var ${3:v} = $1[$2];${0:}
}
# Reversed for loop
snippet forr
for (var ${2:i} = ${1:arr}.length - 1; $2 >= 0; $2 --) {
var ${3:v} = $1[$2];${0:}
}
# While loop
snippet wh
while (${1:/* condition */}) {
${0}
}
# Do while loop
snippet do
do {
${0}
} while (${1:/* condition */});
# For in loop
snippet fori
for (var ${1:prop} in ${2:object}) {
${0:$2[$1]}
}
# Objects
# Object Method
snippet :f
${1:method_name}: function (${2:attribute}) {
${0}
}${3:,}
# setTimeout function
snippet timeout
setTimeout(function () {${0}}${2}, ${1:10});
# Get Elements
snippet get
getElementsBy${1:TagName}('${2}')
# Get Element
snippet gett
getElementBy${1:Id}('${2}')
# console.log (Firebug)
snippet cl
console.log(${0});
# console.debug (Firebug)
snippet cd
console.debug(${0});
# return
snippet ret
return ${0:result}
# for (property in object ) { ... }
snippet fori
for (var ${1:prop} in ${2:Things}) {
${0:$2[$1]}
}
# hasOwnProperty
snippet has
hasOwnProperty(${0})
# docstring
snippet /**
/**
* ${0:description}
*
*/
snippet @par
@param {${1:type}} ${2:name} ${0:description}
snippet @ret
@return {${1:type}} ${0:description}
# JSON.parse
snippet jsonp
JSON.parse(${0:jstr});
# JSON.stringify
snippet jsons
JSON.stringify(${0:object});
# self-defining function
snippet sdf
var ${1:function_name} = function (${2:argument}) {
${3}
$1 = function ($2) {
${0}
};
};
# singleton
snippet sing
function ${1:Singleton} (${2:argument}) {
@ -191,7 +171,7 @@ snippet props
snippet prop
Object.defineProperty(
${1:object},
"${2:property}",
'${2:property}',
{
get : function $1_$2_getter() {
// getter code
@ -205,3 +185,73 @@ snippet prop
configurable : ${0:boolean}
}
);
# Documentation
# docstring
snippet /**
/**
* ${0:description}
*
*/
snippet @par
@param {${1:type}} ${2:name} ${0:description}
snippet @ret
@return {${1:type}} ${0:description}
# JSON
# JSON.parse
snippet jsonp
JSON.parse(${0:jstr});
# JSON.stringify
snippet jsons
JSON.stringify(${0:object});
# DOM selectors
# Get elements
snippet get
getElementsBy${1:TagName}('${0}')
# Get element
snippet gett
getElementBy${1:Id}('${0}')
# Elements by class
snippet by.
${1:document}.getElementsByClassName('${0:class}')
# Element by ID
snippet by#
${1:document}.getElementById('${0:element ID}')
# Query selector
snippet qs
${1:document}.querySelector('${0:CSS selector}')
# Query selector all
snippet qsa
${1:document}.querySelectorAll('${0:CSS selector}')
# Debugging
# console.log
snippet cl
console.log(${0});
# console.debug
snippet cd
console.debug(${0});
# console.trace
snippet ct
console.trace(${0:label});
# console.time
snippet ctime
console.time(${0:label});
# console.assert
snippet ca
console.assert(${1:expression}, ${0:obj});
# console.dir
snippet cdir
console.dir(${0:obj});
# Misc
# setTimeout function
snippet timeout
setTimeout(function () {${0}}${2}, ${1:10});

View File

@ -6,32 +6,27 @@
# Scala lang
#if
snippet if
if(${1:obj}) {
if (${1})
${0}
}
#if not
snippet ifn
if(!${1:obj}) {
if (!${1})
${0}
}
#if-else
snippet ife
if(${1:obj}) {
if (${1})
${2}
} else {
else
${0}
}
#if-else-if
snippet ifelif
if(${1:obj}) {
if (${1})
${2}
} else if(${3:obj}) {
else if (${3})
${0}
}
snippet eif
else if(${3:obj}) {
else if (${3})
${0}
}
#while loop
snippet wh
while (${1:obj}) {

View File

@ -0,0 +1,36 @@
snippet $
$${1:variable}: ${0:value};
snippet imp
@import '${0}';
snippet mix
@mixin ${1:name}(${2}) {
${0}
}
snippet inc
@include ${1:mixin}(${2});
snippet ex
@extend ${0};
snippet fun
@function ${1:name}(${2:args}) {
${0}
}
snippet if
@if ${1:condition} {
${0}
}
snippet else
@else ${1:condition} {
${0}
}
snippet for
@for ${1:$i} from ${2:1} through ${3:3} {
${0}
}
snippet each
@each ${1:$item} in ${2:items} {
${0}
}
snippet while
@while ${1:$i} ${2:>} ${3:0} {
${0}
}