mirror of
https://github.com/amix/vimrc
synced 2025-06-17 10:55:00 +08:00
Updated plugins
This commit is contained in:
@ -157,7 +157,7 @@ Until further work is done on `vim-snipmate`, please don't add folding markers
|
||||
into snippets. `vim-snipmate` has some comments about how to patch all snippets
|
||||
on the fly adding those.
|
||||
|
||||
Currently all snippets from UltiSnips have been put into UltiSnips - some work
|
||||
Currently all snippets from UltiSnips have been put into `/UltiSnips` - some work
|
||||
on merging should be done (dropping duplicates etc). Also see engines section above.
|
||||
|
||||
Related repositories
|
||||
|
@ -31,9 +31,10 @@ endglobal
|
||||
# TextMate Snippets #
|
||||
###########################################################################
|
||||
snippet main
|
||||
int main()
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
${0}
|
||||
return 0;
|
||||
}
|
||||
endsnippet
|
||||
|
||||
|
@ -45,11 +45,11 @@ snippet ! "!important CSS (!)"
|
||||
endsnippet
|
||||
|
||||
snippet tsh "text-shadow: color-hex x y blur (text)"
|
||||
text-shadow: ${1:${2:color} ${3:offset-x} ${4:offset-y} ${5:blur}};$0
|
||||
text-shadow: ${1:${2:offset-x} ${3:offset-y} ${4:blur} ${5:color}};$0
|
||||
endsnippet
|
||||
|
||||
snippet bxsh "box-shadow: color-hex x y blur (text)"
|
||||
box-shadow: ${1:${2:offset-x} ${3:offset-y} ${4:blur} ${5:spread} ${6:color}};$0
|
||||
box-shadow: ${1:${2:offset-x} ${3:offset-y} ${4:blur} ${5:spread} ${6:color} ${7:inset}};$0
|
||||
endsnippet
|
||||
|
||||
#
|
||||
|
@ -1,4 +1,15 @@
|
||||
# https://www.conventionalcommits.org/en/v1.0.0-beta.2/#specification
|
||||
global !p
|
||||
def complete(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 status "Status" bA
|
||||
status $1`!p snip.rv = complete(t[1], ['build', 'ci', 'test', 'refactor', 'perf', 'improvement', 'docs', 'chore', 'feat', 'fix'])`
|
||||
endsnippet
|
||||
|
||||
snippet fix "fix conventional commit"
|
||||
fix(${1:scope}): ${2:title}
|
||||
@ -59,3 +70,61 @@ build(${1:scope}): ${2:title}
|
||||
|
||||
${0:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet sign "Signature"
|
||||
-------------------------------------------------------------------------------
|
||||
${1:Company Name}
|
||||
|
||||
${2:Author Name}
|
||||
|
||||
${3:Streetname 21}
|
||||
${4:City and Area}
|
||||
|
||||
${5:Tel: +44 (0)987 / 888 8888}
|
||||
${6:Fax: +44 (0)987 / 888 8882}
|
||||
${7:Mail: Email}
|
||||
${8:Web: https://}
|
||||
-------------------------------------------------------------------------------
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet t "Todo"
|
||||
TODO: ${1:What is it} (`date "+%b %d %Y %a (%H:%M:%S)"`, `echo $USER`)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet cmt "Commit Structure" bA
|
||||
${1:Summarize changes in around 50 characters or less}
|
||||
|
||||
${2:More detailed explanatory text, if necessary. Wrap it to about 72
|
||||
characters or so. In some contexts, the first line is treated as the
|
||||
subject of the commit and the rest of the text as the body. The
|
||||
blank line separating the summary from the body is critical (unless
|
||||
you omit the body entirely); various tools like `log`, `shortlog`
|
||||
and `rebase` can get confused if you run the two together.}
|
||||
|
||||
${3:Explain the problem that this commit is solving. Focus on why you
|
||||
are making this change as opposed to how (the code explains that).
|
||||
Are there side effects or other unintuitive consequences of this
|
||||
change? Here's the place to explain them.}
|
||||
|
||||
${4:Further paragraphs come after blank lines.
|
||||
|
||||
- Bullet points are okay, too
|
||||
|
||||
- Typically a hyphen or asterisk is used for the bullet, preceded
|
||||
by a single space, with blank lines in between, but conventions
|
||||
vary here}
|
||||
|
||||
${5:Status}
|
||||
|
||||
${6:If you use an issue tracker, put references to them at the bottom,
|
||||
like this.}
|
||||
|
||||
${7:Any todos}
|
||||
|
||||
${8:Resolves: #123
|
||||
See also: #456, #789}
|
||||
|
||||
${9:Signature}
|
||||
endsnippet
|
||||
|
@ -104,4 +104,13 @@ snippet local "local x = 1"
|
||||
local ${1:x} = ${0:1}
|
||||
endsnippet
|
||||
|
||||
snippet use "Use" Ab
|
||||
use { '$1' }
|
||||
endsnippet
|
||||
|
||||
snippet req "Require"
|
||||
require('$1')
|
||||
endsnippet
|
||||
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -343,6 +343,18 @@ write_init_body(args, t[2], snip)
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet dcl "dataclass" b
|
||||
@dataclass
|
||||
class ${1:MyClass}:
|
||||
`!p snip.rv = triple_quotes(snip)`${2:Docstring for $1. }`!p snip.rv = triple_quotes(snip)`
|
||||
${3:var_1}: ${4:int}
|
||||
${5:var_2}: ${6:float} = ${7:0}
|
||||
|
||||
def ${8:total}(self): -> $6:
|
||||
return ${0:self.$3 * self.$5}
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet contain "methods for emulating a container type" b
|
||||
def __len__(self):
|
||||
${1:pass}
|
||||
@ -603,9 +615,9 @@ $1 = property(**$1(), doc=$1.__doc__)
|
||||
endsnippet
|
||||
|
||||
|
||||
####################
|
||||
# If / Else / Elif #
|
||||
####################
|
||||
############################
|
||||
# If / Else / Elif / Match #
|
||||
############################
|
||||
snippet if "If" b
|
||||
if ${1:condition}:
|
||||
${2:${VISUAL:pass}}
|
||||
@ -627,6 +639,22 @@ else:
|
||||
${5:pass}
|
||||
endsnippet
|
||||
|
||||
snippet match "Structural pattern matching" b
|
||||
match ${1:expression}:
|
||||
case ${2:pattern_1}:
|
||||
${3:pass}
|
||||
case ${4:pattern_2}:
|
||||
${0:pass}
|
||||
endsnippet
|
||||
|
||||
snippet matchw "Pattern matching with wildcard" b
|
||||
match ${1:expression}:
|
||||
case ${2:pattern_1}:
|
||||
${3:pass}
|
||||
case _:
|
||||
${0:pass}
|
||||
endsnippet
|
||||
|
||||
|
||||
##########################
|
||||
# Try / Except / Finally #
|
||||
|
@ -799,28 +799,6 @@ snippet xput "xhr put"
|
||||
xhr :put, :${1:update}, id: ${2:1}, ${3:object}: { $4 }$0
|
||||
endsnippet
|
||||
|
||||
snippet sweeper "Create sweeper class"
|
||||
class ${1:Model}Sweeper < ActionController::Caching::Sweeper
|
||||
observe ${1:Model}
|
||||
|
||||
def after_save(${1/./\l$0/})
|
||||
expire_cache(${1/./\l$0/})
|
||||
end
|
||||
|
||||
def after_destroy(${1/./\l$0/})
|
||||
expire_cache(${1/./\l$0/})
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def expire_cache(${1/./\l$0/})
|
||||
${0:expire_page ${1/./\l$0/}s_path
|
||||
expire_page ${1/./\l$0/}_path(${1/./\l$0/})}
|
||||
end
|
||||
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet col "collection routes"
|
||||
collection do
|
||||
${1:get :${2:action}}
|
||||
|
@ -1,67 +1,417 @@
|
||||
priority -50
|
||||
|
||||
extends texmath
|
||||
##########
|
||||
# GLOBAL #
|
||||
##########
|
||||
|
||||
global !p
|
||||
|
||||
def create_table(snip):
|
||||
rows = snip.buffer[snip.line].split('x')[0]
|
||||
cols = snip.buffer[snip.line].split('x')[1]
|
||||
|
||||
int_val = lambda string: int(''.join(s for s in string if s.isdigit()))
|
||||
|
||||
rows = int_val(rows)
|
||||
cols = int_val(cols)
|
||||
|
||||
offset = cols + 1
|
||||
old_spacing = snip.buffer[snip.line][:snip.buffer[snip.line].rfind('\t') + 1]
|
||||
|
||||
snip.buffer[snip.line] = ''
|
||||
|
||||
final_str = old_spacing + "\\begin{tabular}{|" + "|".join(['$' + str(i + 1) for i in range(cols)]) + "|}\n"
|
||||
|
||||
for i in range(rows):
|
||||
final_str += old_spacing + '\t'
|
||||
final_str += " & ".join(['$' + str(i * cols + j + offset) for j in range(cols)])
|
||||
|
||||
final_str += " \\\\\\\n"
|
||||
|
||||
final_str += old_spacing + "\\end{tabular}\n$0"
|
||||
|
||||
snip.expand_anon(final_str)
|
||||
|
||||
def add_row(snip):
|
||||
row_len = int(''.join(s for s in snip.buffer[snip.line] if s.isdigit()))
|
||||
old_spacing = snip.buffer[snip.line][:snip.buffer[snip.line].rfind('\t') + 1]
|
||||
|
||||
snip.buffer[snip.line] = ''
|
||||
|
||||
final_str = old_spacing
|
||||
final_str += " & ".join(['$' + str(j + 1) for j in range(row_len)])
|
||||
final_str += " \\\\\\"
|
||||
|
||||
snip.expand_anon(final_str)
|
||||
|
||||
endglobal
|
||||
|
||||
snippet "\\?b(egin)?" "begin{} / end{}" br
|
||||
\begin{${1:something}}
|
||||
|
||||
###############
|
||||
# ENVIRONMENT #
|
||||
###############
|
||||
|
||||
snippet beg "begin{} / end{}" bi
|
||||
\begin{$1}
|
||||
${0:${VISUAL}}
|
||||
\end{$1}
|
||||
endsnippet
|
||||
|
||||
snippet cnt "Center" bi
|
||||
\begin{center}
|
||||
${0:${VISUAL}}
|
||||
\end{center}
|
||||
endsnippet
|
||||
|
||||
snippet desc "Description" bi
|
||||
\begin{description}
|
||||
\item[${1:${VISUAL}}] $0
|
||||
\end{description}
|
||||
endsnippet
|
||||
|
||||
snippet lemma "Lemma" bi
|
||||
\begin{lemma}
|
||||
${0:${VISUAL}}
|
||||
\end{lemma}
|
||||
endsnippet
|
||||
|
||||
snippet prop "Proposition" bi
|
||||
\begin{prop}[$1]
|
||||
${0:${VISUAL}}
|
||||
\end{prop}
|
||||
endsnippet
|
||||
|
||||
snippet thrm "Theorem" bi
|
||||
\begin{theorem}[$1]
|
||||
${0:${VISUAL}}
|
||||
\end{theorem}
|
||||
endsnippet
|
||||
|
||||
snippet post "postulate" bi
|
||||
\begin{postulate}[$1]
|
||||
${0:${VISUAL}}
|
||||
\end{postulate}
|
||||
endsnippet
|
||||
|
||||
snippet prf "Proof" bi
|
||||
\begin{myproof}[$1]
|
||||
${0:${VISUAL}}
|
||||
\end{myproof}
|
||||
endsnippet
|
||||
|
||||
snippet def "Definition" bi
|
||||
\begin{definition}[$1]
|
||||
${0:${VISUAL}}
|
||||
\end{definition}
|
||||
endsnippet
|
||||
|
||||
snippet nte "Note" bi
|
||||
\begin{note}[$1]
|
||||
${0:${VISUAL}}
|
||||
\end{note}
|
||||
endsnippet
|
||||
|
||||
snippet prob "Problem" bi
|
||||
\begin{problem}[$1]
|
||||
${0:${VISUAL}}
|
||||
\end{problem}
|
||||
endsnippet
|
||||
|
||||
snippet corl "Corollary" bi
|
||||
\begin{corollary}[$1]
|
||||
${0:${VISUAL}}
|
||||
\end{corollary}
|
||||
endsnippet
|
||||
|
||||
snippet example "Example" bi
|
||||
\begin{example}[$1]
|
||||
${0:${VISUAL}}
|
||||
\end{example}
|
||||
endsnippet
|
||||
|
||||
snippet notion "Notation" bi
|
||||
\begin{notation}[$1]
|
||||
$0${VISUAL}
|
||||
\end{notation}
|
||||
endsnippet
|
||||
|
||||
snippet conc "Conclusion" bi
|
||||
\begin{conclusion}[$1]
|
||||
$0${VISUAL}
|
||||
\end{conclusion}
|
||||
endsnippet
|
||||
|
||||
snippet fig "Figure environment" bi
|
||||
\begin{figure}[${1:htpb}]
|
||||
\centering
|
||||
${2:\includegraphics[width=0.8\textwidth]{$3}}
|
||||
\caption{${4:$3}}
|
||||
\label{fig:${5:${3/\W+/-/g}}}
|
||||
\end{figure}
|
||||
endsnippet
|
||||
|
||||
snippet enum "Enumerate" bi
|
||||
\begin{enumerate}
|
||||
\item ${0:${VISUAL}}
|
||||
\end{enumerate}
|
||||
endsnippet
|
||||
|
||||
snippet item "Itemize" bi
|
||||
\begin{itemize}
|
||||
\item ${0:${VISUAL}}
|
||||
\end{itemize}
|
||||
endsnippet
|
||||
|
||||
snippet case "cases" bi
|
||||
\begin{cases}
|
||||
${0:${VISUAL}}
|
||||
\end{cases}
|
||||
endsnippet
|
||||
|
||||
snippet abs "abstract environment" b
|
||||
\begin{abstract}
|
||||
$0
|
||||
\end{abstract}
|
||||
${0:${VISUAL}}
|
||||
.\end{abstract}
|
||||
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}
|
||||
\end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}
|
||||
\begin{${1:t}${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${2:c}}
|
||||
$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
|
||||
|
||||
########
|
||||
# MATH #
|
||||
########
|
||||
|
||||
snippet cc "subset" w
|
||||
\subset
|
||||
endsnippet
|
||||
|
||||
snippet inn "in " w
|
||||
\in
|
||||
endsnippet
|
||||
|
||||
snippet Nn "cap" w
|
||||
\cap
|
||||
endsnippet
|
||||
|
||||
snippet UU "cup" w
|
||||
\cup
|
||||
endsnippet
|
||||
|
||||
snippet uuu "bigcup" w
|
||||
\bigcup_{${1:i \in ${2: I}}} $0
|
||||
endsnippet
|
||||
|
||||
snippet nnn "bigcap" w
|
||||
\bigcap_{${1:i \in ${2: I}}} $0
|
||||
endsnippet
|
||||
|
||||
snippet HH "H" w
|
||||
\mathbb{H}
|
||||
endsnippet
|
||||
|
||||
snippet DD "D" w
|
||||
\mathbb{D}
|
||||
endsnippet
|
||||
|
||||
snippet inmath "Inline Math" w
|
||||
\\(${1}\\) $0
|
||||
endsnippet
|
||||
|
||||
snippet dm "Display Math" w
|
||||
\[
|
||||
${1:${VISUAL}}
|
||||
\]$0
|
||||
endsnippet
|
||||
|
||||
snippet frac "Fraction" w
|
||||
\frac{$1}{$2}$0
|
||||
endsnippet
|
||||
|
||||
snippet compl "Complement" i
|
||||
^{c}
|
||||
endsnippet
|
||||
|
||||
snippet ss "Super Script" i
|
||||
^{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet __ "subscript" Aw
|
||||
_{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet srt "Square Root" wi
|
||||
\sqrt{${1:${VISUAL}}}$0
|
||||
endsnippet
|
||||
|
||||
snippet srto "... Root" wi
|
||||
\sqrt[$1]{${2:${VISUAL}}}$0
|
||||
endsnippet
|
||||
|
||||
snippet bf "Bold" wi
|
||||
\bf{${1:${VISUAL}}}$0
|
||||
endsnippet
|
||||
|
||||
snippet it "Italic" wi
|
||||
\it{${1:${VISUAL}}}$0
|
||||
endsnippet
|
||||
|
||||
snippet un "Underline" wi
|
||||
\un{${1:${VISUAL}}}$0
|
||||
endsnippet
|
||||
|
||||
snippet rm "Text" wi
|
||||
\rm{${1:${VISUAL}}}$0
|
||||
endsnippet
|
||||
|
||||
snippet itm "Item" wi
|
||||
\item ${0:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet ceil "Ceil" w
|
||||
\left\lceil $1 \right\rceil $0
|
||||
endsnippet
|
||||
|
||||
snippet floor "Floor" w
|
||||
\left\lfloor $1 \right\rfloor$0
|
||||
endsnippet
|
||||
|
||||
snippet pmat "Pmat" w
|
||||
\begin{pmatrix} $1 \end{pmatrix} $0
|
||||
endsnippet
|
||||
|
||||
snippet bmat "Bmat" w
|
||||
\begin{bmatrix} $1 \end{bmatrix} $0
|
||||
endsnippet
|
||||
|
||||
snippet () "Left( right)" w
|
||||
\left( ${1:${VISUAL}} \right) $0
|
||||
endsnippet
|
||||
|
||||
snippet lr "left( right)" i
|
||||
\left( ${1:${VISUAL}} \right) $0
|
||||
endsnippet
|
||||
|
||||
snippet lr( "left( right)" i
|
||||
\left( ${1:${VISUAL}} \right) $0
|
||||
endsnippet
|
||||
|
||||
snippet lr| "left| right|" i
|
||||
\left| ${1:${VISUAL}} \right| $0
|
||||
endsnippet
|
||||
|
||||
snippet lr{ "left\{ right\}" i
|
||||
\left\\{ ${1:${VISUAL}} \right\\} $0
|
||||
endsnippet
|
||||
|
||||
snippet lrb "left\{ right\}" i
|
||||
\left\\{ ${1:${VISUAL}} \right\\} $0
|
||||
endsnippet
|
||||
|
||||
snippet lr[ "left[ right]" i
|
||||
\left[ ${1:${VISUAL}} \right] $0
|
||||
endsnippet
|
||||
|
||||
snippet lra "leftangle rightangle" wi
|
||||
\left<${1:${VISUAL}} \right>$0
|
||||
endsnippet
|
||||
|
||||
snippet conj "conjugate" w
|
||||
\overline{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet sum "sum" w
|
||||
\sum_{n=${1:1}}^{${2:\infty}} ${3:a_n z^n}
|
||||
endsnippet
|
||||
|
||||
snippet taylor "taylor" w
|
||||
\sum_{${1:k}=${2:0}}^{${3:\infty}} ${4:c_$1} (x-a)^$1 $0
|
||||
endsnippet
|
||||
|
||||
snippet lim "limit" w
|
||||
\lim_{${1:n} \to ${2:\infty}}
|
||||
endsnippet
|
||||
|
||||
snippet limsup "limsup" w
|
||||
\limsup_{${1:n} \to ${2:\infty}}
|
||||
endsnippet
|
||||
|
||||
snippet prod "product" w
|
||||
\prod_{${1:n=${2:1}}}^{${3:\infty}} ${4:${VISUAL}} $0
|
||||
endsnippet
|
||||
|
||||
snippet part "d/dx" w
|
||||
\frac{\partial ${1:V}}{\partial ${2:x}} $0
|
||||
endsnippet
|
||||
|
||||
snippet ooo "\infty" w
|
||||
\infty
|
||||
endsnippet
|
||||
|
||||
snippet rij "mrij" i
|
||||
(${1:x}_${2:n})_{${3:$2}\\in${4:\\N}}$0
|
||||
endsnippet
|
||||
|
||||
snippet => "Implies" w
|
||||
\implies
|
||||
endsnippet
|
||||
|
||||
snippet =< "Implied by" w
|
||||
\impliedby
|
||||
endsnippet
|
||||
|
||||
snippet iff "iff" w
|
||||
\iff
|
||||
endsnippet
|
||||
|
||||
snippet == "Equals" w
|
||||
&= $1 \\\\
|
||||
endsnippet
|
||||
|
||||
snippet != "Not Equal" w
|
||||
\neq
|
||||
endsnippet
|
||||
|
||||
snippet <= "leq" Aw
|
||||
\le
|
||||
endsnippet
|
||||
|
||||
snippet >= "geq" Aw
|
||||
\ge
|
||||
endsnippet
|
||||
|
||||
snippet nn "Tikz node" w
|
||||
\node[$5] (${1/[^0-9a-zA-Z]//g}${2}) ${3:at (${4:0,0}) }{$${1}$};
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet lll "l" Aw
|
||||
\ell
|
||||
endsnippet
|
||||
|
||||
snippet xx "cross" Aw
|
||||
\times
|
||||
endsnippet
|
||||
|
||||
snippet '(?<!\\)(sin|cos|arccot|cot|csc|ln|log|exp|star|perp)' "ln" rw
|
||||
\\`!p snip.rv = match.group(1)`
|
||||
endsnippet
|
||||
|
||||
snippet <! "normal" Aw
|
||||
\triangleleft
|
||||
endsnippet
|
||||
|
||||
snippet "(\d|\w)+invs" "inverse" Awr
|
||||
`!p snip.rv = match.group(1)`^{-1}
|
||||
endsnippet
|
||||
|
||||
snippet !> "mapsto" Aw
|
||||
\mapsto
|
||||
endsnippet
|
||||
|
||||
##########
|
||||
# TABLES #
|
||||
#########
|
||||
|
||||
pre_expand "create_table(snip)"
|
||||
snippet "gentbl(\d+)x(\d+)" "Generate table of *width* by *height*" r
|
||||
endsnippet
|
||||
@ -70,189 +420,125 @@ pre_expand "add_row(snip)"
|
||||
snippet "tr(\d+)" "Add table row of dimension ..." r
|
||||
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}
|
||||
|
||||
###########
|
||||
# POSTFIX #
|
||||
###########
|
||||
|
||||
snippet bar "bar" wi
|
||||
\bar{${1:${VISUAL}}}$0
|
||||
endsnippet
|
||||
|
||||
snippet fig "Figure environment" b
|
||||
\begin{figure}[${2:htpb}]
|
||||
\centering
|
||||
\includegraphics[width=${3:0.8}\linewidth]{${4:name.ext}}
|
||||
\caption{${4/(\w+)\.\w+/\u$1/}$0}%
|
||||
\label{fig:${4/(\w+)\.\w+/$1/}}
|
||||
\end{figure}
|
||||
snippet "\<(.*?)\|" "bra" wri
|
||||
\bra{`!p snip.rv = match.group(1).replace('q', f'\psi').replace('f', f'\phi')`}
|
||||
endsnippet
|
||||
|
||||
snippet enum "Enumerate" b
|
||||
\begin{enumerate}
|
||||
\item $0
|
||||
\end{enumerate}
|
||||
snippet "\|(.*?)\>" "ket" wri
|
||||
\ket{`!p snip.rv = match.group(1).replace('q', f'\psi').replace('f', f'\phi')`}
|
||||
endsnippet
|
||||
|
||||
snippet item "Itemize" b
|
||||
\begin{itemize}
|
||||
\item $0
|
||||
\end{itemize}
|
||||
endsnippet
|
||||
|
||||
snippet desc "Description" b
|
||||
\begin{description}
|
||||
\item[$1] $0
|
||||
\end{description}
|
||||
endsnippet
|
||||
|
||||
snippet it "Individual item" b
|
||||
\item $0
|
||||
endsnippet
|
||||
|
||||
snippet part "Part" b
|
||||
\part{${1:part name}}%
|
||||
\label{prt:${2:${1/(\w+)|\W+/(?1:\L$0\E:_)/ga}}}
|
||||
|
||||
$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
|
||||
endsnippet
|
||||
|
||||
snippet sec "Section"
|
||||
\section{${1:${VISUAL:section name}}}%
|
||||
\label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet sec* "Section"
|
||||
\section*{${1:${VISUAL:section name}}}%
|
||||
\label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
snippet "(.*)\\bra{(.*?)}([^\|]*?)\>" "braket" Awri
|
||||
`!p snip.rv = match.group(1)`\braket{`!p snip.rv = match.group(2)`}{`!p snip.rv = match.group(3).replace('q', f'\psi').replace('f', f'\phi')`}
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet sub "Subsection"
|
||||
\subsection{${1:${VISUAL:subsection name}}}%
|
||||
\label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
#############
|
||||
# PRE-AMBLE #
|
||||
#############
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet sub* "Subsection"
|
||||
\subsection*{${1:${VISUAL:subsection name}}}%
|
||||
\label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
endsnippet
|
||||
|
||||
snippet ssub "Subsubsection"
|
||||
\subsubsection{${1:${VISUAL:subsubsection name}}}%
|
||||
\label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ssub* "Subsubsection"
|
||||
\subsubsection*{${1:${VISUAL:subsubsection name}}}%
|
||||
\label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
endsnippet
|
||||
|
||||
snippet par "Paragraph"
|
||||
\paragraph{${1:${VISUAL:paragraph name}}}%
|
||||
\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet subp "Subparagraph"
|
||||
\subparagraph{${1:${VISUAL:subparagraph name}}}%
|
||||
\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ac "Acroynm normal" b
|
||||
\ac{${1:acronym}}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet acl "Acroynm expanded" b
|
||||
\acl{${1:acronym}}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ni "Non-indented paragraph" b
|
||||
\noindent
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet pac "Package" b
|
||||
snippet pac "usepackage - removes square braces if options removed" b
|
||||
\usepackage`!p snip.rv='[' if t[1] else ""`${1:options}`!p snip.rv = ']' if t[1] else ""`{${2:package}}$0
|
||||
endsnippet
|
||||
|
||||
snippet lp "Long parenthesis"
|
||||
\left(${1:${VISUAL:contents}}\right)$0
|
||||
snippet docls "Document Class" bA
|
||||
\documentclass{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet "mint(ed)?( (\S+))?" "Minted code typeset" br
|
||||
\begin{listing}
|
||||
\begin{minted}[linenos,numbersep=5pt,frame=lines,framesep=2mm]{${1:`!p
|
||||
snip.rv = match.group(3) if match.group(2) is not None else "language"`}}
|
||||
${2:${VISUAL:code}}
|
||||
\end{minted}
|
||||
\caption{${3:caption name}}
|
||||
\label{lst:${4:${3/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
\end{listing}
|
||||
snippet tmplt "Template"
|
||||
\documentclass{article}
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
\usepackage{import}
|
||||
\usepackage{pdfpages}
|
||||
\usepackage{transparent}
|
||||
\usepackage{xcolor}
|
||||
$1
|
||||
|
||||
snippet gln "New glossary item" b
|
||||
\newglossaryentry{${1:identifier}}
|
||||
{
|
||||
name={${2:name}},
|
||||
first={${3:first occurrence}},
|
||||
sort={${4:sort value}},
|
||||
description={${0:description}},
|
||||
}
|
||||
endsnippet
|
||||
snippet glnl "New long glossary item" b
|
||||
\longnewglossaryentry{${1:identifier}}
|
||||
{
|
||||
name={${2:name}},
|
||||
first={${3:first occurrence}},
|
||||
sort={${4:sort value}},
|
||||
}
|
||||
{
|
||||
${0:description}
|
||||
\newcommand{\incfig}[2][1]{%
|
||||
\def\svgwidth{#1\columnwidth}
|
||||
\import{./figures/}{#2.pdf_tex}
|
||||
}
|
||||
$2
|
||||
\pdfsuppresswarningpagegroup=1
|
||||
|
||||
\begin{document}
|
||||
$0
|
||||
\end{document}
|
||||
endsnippet
|
||||
|
||||
# Bold text
|
||||
snippet bf "Bold"
|
||||
\textbf{$1} $0
|
||||
|
||||
#########
|
||||
# OTHER #
|
||||
#########
|
||||
|
||||
snippet acl "Acroynm expanded" bi
|
||||
\acl{${1:acronym}}
|
||||
endsnippet
|
||||
|
||||
# Italic text
|
||||
snippet ita "Italics"
|
||||
\textit{$1} $0
|
||||
snippet ac "Acroynm normal" bi
|
||||
\ac{${1:acronym}}
|
||||
endsnippet
|
||||
|
||||
# Underlined text
|
||||
snippet und "Underline"
|
||||
\underline{$1} $0
|
||||
snippet ni "Non-indented paragraph" bi
|
||||
\noindent
|
||||
endsnippet
|
||||
|
||||
|
||||
############
|
||||
# SECTIONS #
|
||||
############
|
||||
|
||||
snippet chap "Chapter" wi
|
||||
\chapter{$1${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet sec "Section" wi
|
||||
\section{$1${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet sec* "Section*" wi
|
||||
\section*{$1${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet sub "Subsection" wi
|
||||
\subsection{$1${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet sub* "Subsection*" wi
|
||||
\subsection*{$1${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet subsub "Subsection" wi
|
||||
\subsubsection{$1${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet subsub* "Subsubsection" wi
|
||||
\subsubsection*{$1${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet par "Paragraph" wi
|
||||
\paragraph{$1${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet par* "Paragraph*" wi
|
||||
\paragraph*{$1${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet subpar "Sub Paragraph" wi
|
||||
\subparagraph{$1${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet subpar* "Sub Paragraph*" wi
|
||||
\subparagraph*{$1${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name" : "snipmate-snippets",
|
||||
"name" : "vim-snippets",
|
||||
"author" : "community",
|
||||
"maintainer" : "honza @ github & others",
|
||||
"repository" : {"type": "git", "url": "git://github.com/honza/snipmate-snippets.git"},
|
||||
"repository" : {"type": "git", "url": "git://github.com/honza/vim-snippets.git"},
|
||||
"dependencies" : {
|
||||
},
|
||||
"description" : "community driven set of snippets for snipmate"
|
||||
|
@ -1245,3 +1245,19 @@ snippet ::a
|
||||
::after
|
||||
snippet ::b
|
||||
::before
|
||||
snippet var
|
||||
var(${0:${VISUAL}});
|
||||
snippet vard
|
||||
var(${0}, ${1:${VISUAL});
|
||||
snippet host
|
||||
:host {
|
||||
${1:${VISUAL}}
|
||||
}
|
||||
snippet host(
|
||||
:host(${1}) {
|
||||
${2:${VISUAL}}
|
||||
}
|
||||
snippet part {
|
||||
::part(${1})
|
||||
${2:${VISUAL}}
|
||||
}
|
||||
|
@ -57,3 +57,33 @@ snippet stanim
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# Flutter scaffold application
|
||||
snippet fsa
|
||||
void main() {
|
||||
runApp(
|
||||
MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
debugShowCheckedModeBanner: false,
|
||||
home: const HomePage(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class HomePage extends StatelessWidget {
|
||||
const HomePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Home Page'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,6 +40,9 @@ snippet lica
|
||||
<%= link_to '${1:link text...}', controller: '${2:items}', action: '${0:index}' %>
|
||||
snippet licai
|
||||
<%= link_to '${1:link text...}', controller: '${2:items}', action: '${3:edit}', id: ${0:@item} %>
|
||||
snippet lib
|
||||
<%= link_to '${1:link text...}' do %>
|
||||
<% end %>
|
||||
snippet yield
|
||||
<%= yield ${1::content_symbol} %>
|
||||
snippet conf
|
||||
|
@ -1,29 +1,29 @@
|
||||
snippet des "describe('thing', () => { ... })" b
|
||||
describe('${1:}', () => {
|
||||
snippet des "describe('thing', function() { ... })" b
|
||||
describe('${1:}', function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet it "it('should do', () => { ... })" b
|
||||
it('${1:}', () => {
|
||||
snippet it "it('should do', function() { ... })" b
|
||||
it('${1:}', function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet xit "xit('should do', () => { ... })" b
|
||||
xit('${1:}', () => {
|
||||
snippet xit "xit('should do', function() { ... })" b
|
||||
xit('${1:}', function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet bef "before(() => { ... })" b
|
||||
before(() => {
|
||||
snippet bef "before(function() { ... })" b
|
||||
before(function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet befe "beforeEach(() => { ... })" b
|
||||
beforeEach(() => {
|
||||
snippet befe "beforeEach(function() { ... })" b
|
||||
beforeEach(function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet aft "after(() => { ... })" b
|
||||
after(() => {
|
||||
snippet aft "after(function() { ... })" b
|
||||
after(function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet afte "afterEach(() => { ... })" b
|
||||
afterEach(() => {
|
||||
snippet afte "afterEach(function() { ... })" b
|
||||
afterEach(function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet exp "expect(...)" b
|
||||
|
@ -352,7 +352,7 @@ snippet sym
|
||||
snippet ed
|
||||
export default ${0}
|
||||
snippet ${
|
||||
${${1}}${0}
|
||||
\${${1}}${0}
|
||||
snippet as "async"
|
||||
async ${0}
|
||||
snippet aw "await"
|
||||
|
@ -18,7 +18,7 @@ snippet cremove
|
||||
snippet ccatch
|
||||
<c:catch var="${0}" />
|
||||
snippet cif
|
||||
<c:if test="${${1}}">
|
||||
<c:if test="\${${1}}">
|
||||
${0}
|
||||
</c:if>
|
||||
snippet cchoose
|
||||
@ -26,7 +26,7 @@ snippet cchoose
|
||||
${0}
|
||||
</c:choose>
|
||||
snippet cwhen
|
||||
<c:when test="${${1}}">
|
||||
<c:when test="\${${1}}">
|
||||
${0}
|
||||
</c:when>
|
||||
snippet cother
|
||||
@ -34,12 +34,12 @@ snippet cother
|
||||
${0}
|
||||
</c:otherwise>
|
||||
snippet cfore
|
||||
<c:forEach items="${${1}}" var="${2}" varStatus="${3}">
|
||||
<c:forEach items="\${${1}}" var="${2}" varStatus="${3}">
|
||||
${0:<c:out value="$2" />}
|
||||
</c:forEach>
|
||||
snippet cfort
|
||||
<c:set var="${1}">${2:item1,item2,item3}</c:set>
|
||||
<c:forTokens var="${3}" items="${$1}" delims="${4:,}">
|
||||
<c:forTokens var="${3}" items="\${$1}" delims="${4:,}">
|
||||
${0:<c:out value="$3" />}
|
||||
</c:forTokens>
|
||||
snippet cparam
|
||||
@ -56,13 +56,13 @@ snippet cimport+
|
||||
</c:import>
|
||||
snippet curl
|
||||
<c:url value="${1}" var="${2}" />
|
||||
<a href="${$2}">${0}</a>
|
||||
<a href="\${$2}">${0}</a>
|
||||
snippet curl+
|
||||
<c:url value="${1}" var="${2}">
|
||||
<c:param name="${4}" value="${5}" />
|
||||
cparam+${0}
|
||||
</c:url>
|
||||
<a href="${$2}">${3}</a>
|
||||
<a href="\${$2}">${3}</a>
|
||||
snippet credirect
|
||||
<c:redirect url="${0}" />
|
||||
snippet contains
|
||||
|
@ -6,6 +6,11 @@ snippet pfun
|
||||
private fun ${1:name}(${2}): ${3:String} {
|
||||
${4}
|
||||
}
|
||||
snippet main
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
${0}
|
||||
}
|
||||
snippet ret
|
||||
return ${0}
|
||||
snippet whe
|
||||
|
@ -28,7 +28,7 @@ snippet ife
|
||||
${3}
|
||||
}
|
||||
snippet eif
|
||||
elsif ${1) {
|
||||
elsif ${1} {
|
||||
${2}
|
||||
}
|
||||
# Conditional One-line
|
||||
|
@ -12,6 +12,7 @@ snippet uni
|
||||
${0:representation}
|
||||
snippet from
|
||||
from ${1:package} import ${0:module}
|
||||
|
||||
# Module Docstring
|
||||
snippet docs
|
||||
"""
|
||||
@ -29,18 +30,22 @@ snippet sk "skip unittests" b
|
||||
snippet wh
|
||||
while ${1:condition}:
|
||||
${0:${VISUAL}}
|
||||
|
||||
# dowh - does the same as do...while in other languages
|
||||
snippet dowh
|
||||
while True:
|
||||
${1}
|
||||
if ${0:condition}:
|
||||
break
|
||||
|
||||
snippet with
|
||||
with ${1:expr} as ${2:var}:
|
||||
${0:${VISUAL}}
|
||||
|
||||
snippet awith
|
||||
async with ${1:expr} as ${2:var}:
|
||||
${0:${VISUAL}}
|
||||
|
||||
# New Class
|
||||
snippet cl
|
||||
class ${1:ClassName}(${2:object}):
|
||||
@ -52,11 +57,24 @@ snippet cl
|
||||
snippet cla
|
||||
class ${1:class_name}:
|
||||
"""${0:description}"""
|
||||
|
||||
snippet clai
|
||||
class ${1:class_name}:
|
||||
"""${2:description}"""
|
||||
def __init__(self, ${3:args}):
|
||||
${0}
|
||||
|
||||
# Data class
|
||||
snippet dcl dataclass
|
||||
@dataclass
|
||||
class ${1:ClassName}:
|
||||
"""${2:description}"""
|
||||
${3:var_1}: ${4:int}
|
||||
${5:var_2}: ${6:float} = ${7:0}
|
||||
|
||||
def ${8:total}(self): -> $6:
|
||||
return ${0:self.$3 * self.$5}
|
||||
|
||||
# New Function
|
||||
snippet def
|
||||
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||
@ -72,6 +90,7 @@ snippet adef
|
||||
snippet adeff
|
||||
async def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||
${0}
|
||||
|
||||
# New Method
|
||||
snippet defi
|
||||
def __init__(self, ${1:args}):
|
||||
@ -88,11 +107,11 @@ snippet property
|
||||
@property
|
||||
def ${1:foo}(self) -> ${2:type}:
|
||||
"""${3:doc}"""
|
||||
return self._${1:foo}
|
||||
return self._$1
|
||||
|
||||
@${1:foo}.setter
|
||||
def ${1:foo}(self, value: ${2:type}):
|
||||
self._${1:foo} = value
|
||||
@$1.setter
|
||||
def $1(self, value: $2):
|
||||
self._$1 = value
|
||||
|
||||
# Ifs
|
||||
snippet if
|
||||
@ -104,10 +123,28 @@ snippet el
|
||||
snippet ei
|
||||
elif ${1:condition}:
|
||||
${0:${VISUAL}}
|
||||
|
||||
# Match
|
||||
snippet match Structural pattern matching
|
||||
match ${1:expression}:
|
||||
case ${2:pattern_1}:
|
||||
${3:pass}
|
||||
case ${4:pattern_2}:
|
||||
${5:pass}
|
||||
|
||||
# Match with wildcard
|
||||
snippet matchw Pattern matching with wildcard
|
||||
match ${1:expression}:
|
||||
case ${2:pattern_1}:
|
||||
${3:pass}
|
||||
case _:
|
||||
${0:pass}
|
||||
|
||||
# For
|
||||
snippet for
|
||||
for ${1:item} in ${2:items}:
|
||||
${0}
|
||||
|
||||
# Encodes
|
||||
snippet cutf8
|
||||
# -*- coding: utf-8 -*-
|
||||
@ -115,15 +152,18 @@ snippet clatin1
|
||||
# -*- coding: latin-1 -*-
|
||||
snippet cascii
|
||||
# -*- coding: ascii -*-
|
||||
|
||||
# Lambda
|
||||
snippet ld
|
||||
${1:var} = lambda ${2:vars} : ${0:action}
|
||||
|
||||
snippet ret
|
||||
return ${0}
|
||||
snippet .
|
||||
self.
|
||||
snippet sa self.attribute = attribute
|
||||
self.${1:attribute} = $1
|
||||
|
||||
snippet try Try/Except
|
||||
try:
|
||||
${1:${VISUAL}}
|
||||
@ -152,6 +192,7 @@ snippet tryef Try/Except/Else/Finally
|
||||
${5}
|
||||
finally:
|
||||
${0}
|
||||
|
||||
# if __name__ == '__main__':
|
||||
snippet ifmain
|
||||
if __name__ == '__main__':
|
||||
@ -159,6 +200,10 @@ snippet ifmain
|
||||
# __magic__
|
||||
snippet _
|
||||
__${1:init}__
|
||||
|
||||
# debugger breakpoint
|
||||
snippet br
|
||||
breakpoint()
|
||||
# python debugger (pdb)
|
||||
snippet pdb
|
||||
__import__('pdb').set_trace()
|
||||
@ -192,9 +237,11 @@ snippet nosetrace
|
||||
__import__('nose').tools.set_trace()
|
||||
snippet pprint
|
||||
__import__('pprint').pprint(${1})
|
||||
|
||||
snippet "
|
||||
"""${0:doc}
|
||||
"""
|
||||
|
||||
# assertions
|
||||
snippet a=
|
||||
self.assertEqual(${0}, ${1})
|
||||
@ -215,6 +262,7 @@ snippet tgwt
|
||||
# then: ${3}
|
||||
snippet fut
|
||||
from __future__ import ${0}
|
||||
|
||||
#getopt
|
||||
snippet getopt
|
||||
try:
|
||||
@ -232,6 +280,7 @@ snippet getopt
|
||||
${0}
|
||||
elif option in ("-v", "--verbose"):
|
||||
verbose = argument
|
||||
|
||||
# argparse
|
||||
snippet addp
|
||||
parser = ${VISUAL:argparse.}ArgumentParser()
|
||||
@ -275,7 +324,7 @@ snippet epydoc
|
||||
"""
|
||||
snippet dol
|
||||
def ${1:__init__}(self, *args, **kwargs):
|
||||
super(${0:ClassName}, self).$1(*args, **kwargs)
|
||||
super(${0:ClassName}, self).$1(*args, **kwargs)
|
||||
snippet kwg
|
||||
self.${1:var_name} = kwargs.get('$1', ${2:None})
|
||||
snippet lkwg
|
||||
|
@ -274,22 +274,6 @@ snippet sl
|
||||
end
|
||||
snippet sha1
|
||||
Digest::SHA1.hexdigest(${0:string})
|
||||
snippet sweeper
|
||||
class ${1:ModelClassName}Sweeper < ActionController::Caching::Sweeper
|
||||
observe $1
|
||||
|
||||
def after_save(${0:model_class_name})
|
||||
expire_cache($2)
|
||||
end
|
||||
|
||||
def after_destroy($2)
|
||||
expire_cache($2)
|
||||
end
|
||||
|
||||
def expire_cache($2)
|
||||
expire_page
|
||||
end
|
||||
end
|
||||
snippet va validates_associated
|
||||
validates_associated :${0:attribute}
|
||||
snippet va validates .., acceptance: true
|
||||
|
@ -598,6 +598,8 @@ snippet begin
|
||||
#debugging
|
||||
snippet debug
|
||||
require 'byebug'; byebug
|
||||
snippet dbg
|
||||
require 'debug'; debugger
|
||||
snippet debug19
|
||||
require 'debugger'; debugger
|
||||
snippet debug18
|
||||
|
@ -17,7 +17,7 @@ snippet *
|
||||
# Definition
|
||||
snippet def
|
||||
(define (${1:name})
|
||||
(${0:definition}))
|
||||
${0:definition})
|
||||
|
||||
# Definition with lambda
|
||||
snippet defl
|
||||
|
@ -55,7 +55,7 @@ snippet go
|
||||
done
|
||||
# Set SCRIPT_DIR variable to directory script is located.
|
||||
snippet sdir
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
SCRIPT_DIR="\$( cd "\$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# getopt
|
||||
snippet getopt
|
||||
__ScriptVersion="${1:version}"
|
||||
@ -66,7 +66,7 @@ snippet getopt
|
||||
#===============================================================================
|
||||
function usage ()
|
||||
{
|
||||
echo "Usage : $${0:0} [options] [--]
|
||||
echo "Usage : \$${0:0} [options] [--]
|
||||
|
||||
Options:
|
||||
-h|help Display this message
|
||||
@ -80,18 +80,18 @@ snippet getopt
|
||||
|
||||
while getopts ":hv" opt
|
||||
do
|
||||
case $opt in
|
||||
case \$opt in
|
||||
|
||||
h|help ) usage; exit 0 ;;
|
||||
|
||||
v|version ) echo "$${0:0} -- Version $__ScriptVersion"; exit 0 ;;
|
||||
v|version ) echo "\$${0:0} -- Version \$__ScriptVersion"; exit 0 ;;
|
||||
|
||||
* ) echo -e "\n Option does not exist : $OPTARG\n"
|
||||
* ) echo -e "\\n Option does not exist : \$OPTARG\\n"
|
||||
usage; exit 1 ;;
|
||||
|
||||
esac # --- end of case ---
|
||||
done
|
||||
shift $(($OPTIND-1))
|
||||
shift \$(($OPTIND-1))
|
||||
snippet root
|
||||
if [ \$(id -u) -ne 0 ]; then exec sudo \$0; fi
|
||||
|
||||
|
@ -63,7 +63,7 @@ snippet eq equation environment
|
||||
snippet eql Labeled equation environment
|
||||
\\begin{equation}
|
||||
\\label{eq:${2}}
|
||||
${0:${VISUAL}}
|
||||
${0:${VISUAL}}
|
||||
\\end{equation}
|
||||
# Equation
|
||||
snippet eq* unnumbered equation environment
|
||||
@ -406,6 +406,10 @@ snippet ddot ddot
|
||||
snippet vec vector
|
||||
\\vec{{$1}} {$0}
|
||||
|
||||
# Bar
|
||||
snippet bar bar
|
||||
\\bar{{$1}} {$0}
|
||||
|
||||
# Cross product
|
||||
snippet \x cross product
|
||||
\\times {$0}
|
||||
|
@ -50,7 +50,7 @@ snippet vactions
|
||||
${1:updateValue}({commit}, ${2:payload}) {
|
||||
commit($1, $2);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
# Add in js animation hooks
|
||||
snippet vanim:js:el
|
||||
@ -106,14 +106,33 @@ snippet vdata
|
||||
return {
|
||||
${1:key}: ${2:value}
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
snippet vmounted
|
||||
mounted() {
|
||||
console.log('mounted');
|
||||
},
|
||||
|
||||
snippet vmethods
|
||||
methods: {
|
||||
${1:method}() {
|
||||
console.log('method');
|
||||
}
|
||||
},
|
||||
|
||||
snippet vcomputed
|
||||
computed: {
|
||||
${1:fnName}() {
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
snippet vfilter
|
||||
filters: {
|
||||
${1:fnName}: function(${2:value}) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
snippet vfor
|
||||
<div v-for="${1:item} in ${2:items}" :key="$1.id">
|
||||
@ -125,7 +144,7 @@ snippet vgetters
|
||||
${1:value}: state => {
|
||||
return state.$1;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
snippet vimport
|
||||
import ${1:New} from './components/$1.vue';
|
||||
@ -152,7 +171,7 @@ snippet vmutations
|
||||
${1:updateValue}(state, ${3:payload}) => {
|
||||
state.${2:value} = $3;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
snippet vprops:d
|
||||
${1:propName}: {
|
||||
|
Reference in New Issue
Block a user