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

Updated plugins

This commit is contained in:
amix
2016-06-26 13:12:36 +02:00
parent 0228ad0e9e
commit 0cb4702c1e
74 changed files with 10264 additions and 3014 deletions

View File

@ -186,7 +186,7 @@ snippet iblock "" bi
{% block ${1:blockname} %}${VISUAL}{% endblock $1 %}
endsnippet
snippet csfr "" bi
snippet csrf "" bi
{% csrf_token %}
endsnippet

View File

@ -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):
@ -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])
@ -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])`;
}

View File

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

View File

@ -23,7 +23,7 @@ class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
` extends ObjectBehavior
{
function it${1}()
function it_${1}()
{
$0
}
@ -31,7 +31,7 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet
snippet it "function it_does_something() { ... }"
function it${1}()
function it_${1}()
{
${0:${VISUAL}}
}
@ -163,11 +163,11 @@ endsnippet
# Scalar type matchers
snippet sbscalar "$this->XYZ()->shouldBeString|Array|Bool()"
$this->${1:method}()->shouldBe(${2:'String|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'});
$this->${1:method}()->shouldNotBe${2:String|Array|Bool}();
endsnippet
# Contain matcher

View File

@ -3,7 +3,7 @@ priority -50
## Snippets from SnipMate, taken from
## https://github.com/scrooloose/snipmate-snippets.git
snippet getter "PHP Class Getter" b
snippet gm "PHP Class Getter" b
/**
* Getter for $1
*
@ -11,11 +11,11 @@ snippet getter "PHP Class Getter" b
*/
public function get${1/\w+\s*/\u$0/}()
{
return $this->$1;$3
return $this->$1;
}
endsnippet
snippet setter "PHP Class Setter" b
snippet sm "PHP Class Setter" b
/**
* Setter for $1
*
@ -24,11 +24,10 @@ snippet setter "PHP Class Setter" b
*/
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;$5
$this->$1 = $$1;
${6:return $this;}
${5:return $this;}
}
$0
endsnippet
snippet gs "PHP Class Getter Setter" b
@ -39,22 +38,21 @@ snippet gs "PHP Class Getter Setter" b
*/
public function get${1/\w+\s*/\u$0/}()
{
return $this->$1;$3
return $this->$1;
}
/**
* Setter for $1
*
* @param $2 $$1
* @return ${4:`!p snip.rv=snip.basename`}
* @return ${3:`!p snip.rv=snip.basename`}
*/
public function set${1/\w+\s*/\u$0/}(${5:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$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;$6
$this->$1 = $$1;
${7:return $this;}
${5:return $this;}
}
$0
endsnippet
snippet pub "Public function" b

View File

@ -1,3 +1,5 @@
extends html
snippet %
<% ${0} %>
snippet =

View File

@ -47,28 +47,27 @@ snippet m
{
${0}
}
# setter method
snippet sm
snippet sm "PHP Class Setter"
/**
* Sets the value of ${1:foo}
*
* @param ${2:$1} $$1 ${3:description}
* @param ${2:string} $$1 ${3:description}
*
* @return ${4:`vim_snippets#Filename()`}
*/
${5:public} function set${6:$2}(${7:$2 }$$1)
${5:public} function set${6:$1}(${7:$2 }$$1)
{
$this->${8:$1} = $$1;
return $this;
}
# getter method
snippet gm
snippet gm "PHP Class Getter Setter"
/**
* Gets the value of ${1:foo}
*
* @return ${2:$1}
* @return ${2:string}
*/
${3:public} function get${4:$2}()
${3:public} function get${4:$1}()
{
return $this->${5:$1};
}
@ -391,13 +390,13 @@ snippet ve "Dumb debug helper in HTML"
snippet pc "Dumb debug helper in cli"
var_export($1);$0
# Getters & Setters
snippet gs
snippet gs "PHP Class Getter Setter"
/**
* Gets the value of ${1:foo}
*
* @return ${2:$1}
* @return ${2:string}
*/
public function get${3:$2}()
public function get${3:$1}()
{
return $this->${4:$1};
}

View File

@ -0,0 +1,36 @@
extends css
snippet $
$${1:variable}: ${0:value}
snippet imp
@import '${0}'
snippet mix
@mixin ${1:name}(${2})
${0}
snippet inc
@include ${1:mixin}(${2})
snippet ext
@extend ${0}
snippet fun
@function ${1:name}(${2:args})
${0}
snippet if
@if ${1:condition}
${0}
snippet ife
@if ${1:condition}
${2}
@else
${0}
snippet eif
@else if ${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}

View File

@ -16,57 +16,57 @@ snippet dmo \DeclareMathOperator
# \begin{}...\end{}
snippet begin \begin{} ... \end{} block
\begin{${1:env}}
${0}
${0:${VISUAL}}
\end{$1}
# Tabular
snippet tab tabular (or arbitrary) environment
\begin{${1:tabular}}{${2:c}}
${0}
${0:${VISUAL}}
\end{$1}
snippet thm thm (or arbitrary) environment with optional argument
\begin[${1:author}]{${2:thm}}
${0}
${0:${VISUAL}}
\end{$2}
snippet center center environment
\begin{center}
${0}
${0:${VISUAL}}
\end{center}
# Align(ed)
snippet ali align(ed) environment
\begin{align${1:ed}}
\label{eq:${2}}
${0}
${0:${VISUAL}}
\end{align$1}
# Gather(ed)
snippet gat gather(ed) environment
\begin{gather${1:ed}}
${0}
${0:${VISUAL}}
\end{gather$1}
# Equation
snippet eq equation environment
\begin{equation}
${0}
${0:${VISUAL}}
\end{equation}
# Equation
snippet eql Labeled equation environment
\begin{equation}
\label{eq:${2}}
${0}
${0:${VISUAL}}
\end{equation}
# Equation
snippet eq* unnumbered equation environment
\begin{equation*}
${0}
${0:${VISUAL}}
\end{equation*}
# Unnumbered Equation
snippet \ unnumbered equation: \[ ... \]
\[
${0}
${0:${VISUAL}}
\]
# Equation array
snippet eqnarray eqnarray environment
\begin{eqnarray}
${0}
${0:${VISUAL}}
\end{eqnarray}
# Label
snippet lab \label
@ -90,7 +90,7 @@ snippet itemize itemize environment
\item ${0}
\end{itemize}
snippet item \item
\item ${1}
\item ${1:${VISUAL}}
# Description
snippet desc description environment
\begin{description}
@ -103,18 +103,18 @@ snippet ]i \item (recursive)
# Matrix
snippet mat smart matrix environment
\begin{${1:p/b/v/V/B/small}matrix}
${0}
${0:${VISUAL}}
\end{$1matrix}
# Cases
snippet cas cases environment
\begin{cases}
${1:equation}, &\text{ if }${2:case}\\
${0}
${0:${VISUAL}}
\end{cases}
# Split
snippet spl split environment
\begin{split}
${0}
${0:${VISUAL}}
\end{split}
# Part
snippet part document \part
@ -203,32 +203,32 @@ snippet fcite \footcite[]{}
\footcite[${1}]{${2}}${0}
#Formating text: italic, bold, underline, small capital, emphase ..
snippet it italic text
\textit{${0:text}}
\textit{${0:${VISUAL:text}}}
snippet bf bold face text
\textbf{${0:text}}
\textbf{${0:${VISUAL:text}}}
snippet under underline text
\underline{${0:text}}
\underline{${0:${VISUAL:text}}}
snippet emp emphasize text
\emph{${0:text}}
\emph{${0:${VISUAL:text}}}
snippet sc small caps text
\textsc{${0:text}}
\textsc{${0:${VISUAL:text}}}
#Choosing font
snippet sf sans serife text
\textsf{${0:text}}
\textsf{${0:${VISUAL:text}}}
snippet rm roman font text
\textrm{${0:text}}
\textrm{${0:${VISUAL:text}}}
snippet tt typewriter (monospace) text
\texttt{${0:text}}
\texttt{${0:${VISUAL:text}}}
#Math font
snippet mf mathfrak
\mathfrak{${0:text}}
\mathfrak{${0:${VISUAL:text}}}
snippet mc mathcal
\mathcal{${0:text}}
\mathcal{${0:${VISUAL:text}}}
snippet ms mathscr
\mathscr{${0:text}}
\mathscr{${0:${VISUAL:text}}}
#misc
snippet ft \footnote
\footnote{${0:text}}
\footnote{${0:${VISUAL:text}}}
snippet fig figure environment (includegraphics)
\begin{figure}
\begin{center}
@ -260,19 +260,19 @@ snippet lim \lim_{}
\lim_{${1:n \to \infty}} ${0}
snippet frame frame environment
\begin{frame}[${1:t}]{${2:title}}
${0}
${0:${VISUAL}}
\end{frame}
snippet block block environment
\begin{block}{${1:title}}
${0}
${0:${VISUAL}}
\end{block}
snippet alert alertblock environment
\begin{alertblock}{${1:title}}
${0}
${0:${VISUAL}}
\end{alertblock}
snippet example exampleblock environment
\begin{exampleblock}{${1:title}}
${0}
${0:${VISUAL}}
\end{exampleblock}
snippet col2 two-column environment
\begin{columns}
@ -301,7 +301,7 @@ snippet lra langle rangle
# Code listings
snippet lst
\begin{listing}[language=${1:language}]
${0}
${0:${VISUAL}}
\end{listing}
snippet lsi
\lstinline|${1}| ${0}