-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnippets.cson
256 lines (248 loc) · 7.7 KB
/
snippets.cson
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
# '.source.coffee':
# 'Console log':
# 'prefix': 'log'
# 'body': 'console.log $1'
#
# Each scope (e.g. '.source.coffee' above) can only be declared once.
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it in the
# Atom Flight Manual:
# http://flight-manual.atom.io/using-atom/sections/basic-customization/#_cson
'.source.coffee':
'Console log':
'prefix': 'hello'
'body': 'console.error(${1:"crash"});$2'
# the snippets for C
'.source.c':
'#define':
'prefix': 'de'
'body': '#define $1 $2'
'break':
'prefix': 'b'
'body': 'break;\n'
'for loop':
'prefix':'for'
'body':'for(${1:int} ${2:i} = ${3:0}; ${2:i} < ${4:len}; ++${2:i}){$5\n\t$6\n}$7'
'include <>':
'prefix':'Inc'
'body':'#include <$1.h>$2'
'printf':
'prefix':'printf'
'body': 'printf("$1\\\\n"$2);$3'
# the snippets for C++
# ################################
# this part is the same as above
'.source.cpp':
'#define':
'prefix': 'de'
'body': '#define $1 $2'
'break':
'prefix': 'b'
'body': 'break;\n'
##################################
'for loop':
'prefix':'for'
'body':'for(${1:size_t} ${2:i} = ${3:0}; ${2:i} < ${4:len}; ++${2:i}){$5\n\t$6\n}$7'
'iostream std::':
'prefix': 'io'
'body': '#include <iostream>\n\nusing namespace std;'
'pythonic for':
'prefix': 'forin'
'body':'for(${1:int} ${2:i}: ${2:i}s){\n\t$3\n}'
'cout':
'prefix':'cout'
'body':'cout << "${1:/* message */}" $2<< endl;$3'
'print endl':
'prefix':'endl'
'body':'cout << endl;$1'
'#include""':
'prefix': 'inc'
'body': '#include "$1.h"$2'
'vector':
'prefix': 'vector'
'body': 'vector<${1:int}> $2 ${3:;}'
'try-catch':
'prefix':'try-catch'
'body':'try{\n\t$1\n}catch($2){\n\t$3\n}$4'
'Class':
'prefix':'cl'
'body':'class ${1:name_t} $2{\n public:\n\t${1:name_t} (${4:/*arguments*/});\n\t~${1:name_t} ();\n\n private:\n\t${3:/* data */}\n};$5'
'template':
'prefix': 'template'
'body':'template <typename ${1:T}>'
# the snippets for LaTeX
'.text.tex.latex':
# environment
'figure':
'prefix':'figure'
'body':'${6:% \\\\cref{fig:$1\\}}$7\n\\\\begin{figure}[${5:H}]\n\t\\\\centering\n\t\\\\includegraphics[width = ${4:0.6}\\\\textwidth]{$1}\n\t%\\\\missingfigure\{$1\}$8\n\t\\\\caption{$2}\n\t\\\\label{fig:$1}\n\\\\end{figure}$0'
'tabular':
'prefix':'tabular'
'body':'% \\\\cref{t:$2\\}$10\n\\\\begin{table}[H]\n\t\\\\caption{$1}\n\t\\\\label{t:$2}\n\t\\\\centering\n\t\\\\begin{tabular}{${3:ccc}}\n\t\\\\toprule[1.5pt]\n\t\t\\\\makebox[${4:0.1}\\\\textwidth]{$5}$6\\\\\\\\\n\t\t\\\\midrule[1pt]\n\t\t$7\n\t\t${8:% \\\\specialrule{0em}{8pt}{1pt}}\n\t\\\\bottomrule[1.5pt]\n\t\\\\end{tabular}\n\\\\end{table}$11'
'makebox':
'prefix':'makebox'
'body': '\\\\makebox[$1\\\\textwidth]{$2} ${3:&} $0'
'equation':
'prefix':'equation'
'body':'\\\\begin{equation}\n\t$2\n\t\\\\label{eq:$1}\n\\\\end{equation}$0'
'assumption':
'prefix':'assumption'
'body':'\\\\begin{assumption}\\\\label{asu:$1}\n\t$2\n\\\\end{assumption}$0'
'insert code':
'prefix' : 'code'
'body': '\\\\begin{lstlisting}[language=$1]
\n\t$2\n\\\\end{lstlisting}'
'frame':
'prefix':'frame'
'body':'\\\\begin{frame}$1\n\t$2\n\\\\end{frame}'
'column':
'prefix':'column'
'body':'\\\\begin{columns}[c]\n\t\\\\column{${1:0.6}\\\\textwidth}\n\t\t$4\n\t\\\\column{${2:0.3}\\\\textwidth}\n\t\t$3\n\\\\end{columns}$0'
'definition':
'prefix': 'definition'
'body': '\\\\begin{definition}$1\n\t$2\n\\\\end{definition}'
'\\[...\\]':
'prefix':'display-style'
'body':'\\\\[\n\t$1\n\\\\]\n$0'
'problem environment':
'prefix':'problem'
'body':'\\\\begin\{problem\}\n\t$1\n\\\\end\{problem\}$0'
'solution environment':
'prefix': 'solution'
'body':'\\\\begin\{solution\}\n\t$1\n\\\\end\{solution\}$0'
'theorem environment':
'prefix':'theorem'
'body':'\\\\begin\{theorem\}$1\n\t$2\n\\\\end\{theorem\}$0'
'script environment':
'prefix':'begin lstlisting'
'body':'\\\\begin{lstlisting}$1\n\t$2\n\\\\end{lstlisting}'
"alg-if":
"prefix":"IF"
"body":"\\\\li \\\\If $1:\n\\\\Then\n\t\\\\li $2\n\\\\End$0"
"glsxtrnewsymbol":
"prefix": "glsxtrnewsymbol"
"body" : "\\\\glsxtrnewsymbol[\n\tdescription={%\n\t\t${4:description}\n\t},\n\tunit={\\\\si{${3:(optional) unit}}}\n]{${1:variable name}}{\\\\ensuremath{${2:math notation}}}"
##
## greek alpha
'sigma':
'prefix':'sigma'
'body':'\\\\sigma'
'theta':
'prefix':'theta'
'body':'\\\\theta'
'lambda':
'prefix':'lambda'
'body':'\\\\lambda'
'epsilon':
'prefix':'epsilon'
'body':'\\\\epsilon'
'partial':
'prefix':'partial'
'body':'\\\\partial'
##
'符号约定':
'prefix':'fuhao'
'body':'\$$1\$ & $2 \\\\\\\\ $0'
'frac':
'prefix':'frac'
'body':'\\\\dfrac{$1}{$2}$0'
'sum':
'prefix': 'sum'
'body':'\\\\sum'
'sum_':
'prefix': 'sum_'
'body':'\\\\sum_{$1}^{$2}$3'
'_{}':
'prefix':'_\{\}'
'body':'_\{$1\}'
'bar':
'prefix':'bar'
'body':'\\\\bar{$1}$2'
'^{}':
'prefix':'^\{\}'
'body':'^\{$1\}'
'left right':
'prefix':'left'
'body':'\\\\left$1 $3 \\\\right$2 $0'
'dots':
'prefix': '\\dots'
'body' : '\\\\dots'
'\\(...\\)':
'prefix':'inline'
'body': '\\\\( $1 \\\\)$0'
'\\dots':
'prefix':'dots'
'body':'\\\\dots'
'\\hat':
'prefix':'hat'
'body':'\\\\hat{$1}$0'
'\\infty':
'prefix':'infty'
'body':'\\\\infty'
'\\int_^':
'prefix':'int'
'body':'\\\\int_{$1}^{$2}$0'
'\\lstinputlisting':
'prefix':'lstinputlisting'
'body':'\\\\lstinputlisting$1{$2}$0'
'newacronym':
'prefix':"newacronym"
'body':"\\\\newacronym{${1:id}}{${2:short}}{${3:desc}}\n\\\\gls{$1}$0"
'acronym-def':
'prefix':"acronym-def"
'body':"\\\\newacronym{${1:id}}{${2:short}}{${3:desc}}\n\\\\begin{definition}[\\\\gls{$1}]\n\t$4\n\\\\end{definition}$0"
'bash-code':
'prefix':'bash'
'body':"\\\\begin{lstlisting}[language=bash]\n\t$1\n\\\\end{lstlisting}$0"
'python-code':
'prefix':'bash'
'body':"\\\\begin{lstlisting}[language=python]\n\t$1\n\\\\end{lstlisting}$0"
'text-code':
'prefix':'bash'
'body':"\\\\begin{lstlisting}\n\t$1\n\\\\end{lstlisting}$0"
## tikz
'draw':
'prefix':'draw'
'body':'\\\\draw ${1:[$2]}(${3:0},${4:0}) ${7:--} (${5:0},${6:0})$8;$0'
'circle(tikz)':
'prefix':'circle'
'body': '(${1:0},${2:0}) circle [radius=${3:2}pt]$0'
'arc':
'prefix':'arc'
'body':'\\\\draw (${1:0}mm, ${2:0}mm) arc [start angle=${3:0}, end angle=${4:0}, radius=${5:0}mm]$0;'
'clip':
'prefix':'clip'
'body':'\\\\clip (${1:0}, ${2:0}) rectangle (${3:0},${4:0});'
'node':
'prefix':'node'
'body': '\\\\node[${1:block}]($2){$3};$4'
'below of':
'prefix':'below of'
'body':'below of='
'node distance':
'prefix':'node distance'
'body':'node distance=${1:3cm}$0'
'path':
'prefix':'path'
'body':'\\\\path[${1:line}] ($2) ${4:--} ($3);$0'
'inport from inkscape':
'prefix': 'inkspace'
'body':'${6:%\\\\cref{fig:$1\\}}$7\n\\\\begin{figure}[${5:H}]\n\t\\\\centering\n\t\\\\def\\\\svgwidth{${3:0.6}\\\\\linewidth}\n\t\\\\input{figures/$1.pdf_tex}\n\t\\\\caption{$2}\n\t\\\\label{fig:$1}\n\\\\end{figure}$0'
######################
# sql
######################
'.source.sql':
'insert':
'prefix': 'insert into'
'body':'insert into ${1:table}\n\tvalues ($2);$0'