Skip to content

Commit 995ab73

Browse files
committed
Merge pull request #352 from feju/master
Various new snippets and fixes
2 parents fa8778d + 18d24cb commit 995ab73

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

UltiSnips/r.snippets

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ lapply(${1:list}, ${0:function})
8888
endsnippet
8989

9090
snippet sapply "sapply function"
91-
lapply(${1:list}, ${0:function})
91+
sapply(${1:list}, ${0:function})
9292
endsnippet
9393

9494
snippet vapply "vapply function"

snippets/r.snippets

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ for (${1:item} in ${2:list}) {
3535

3636
# functions
3737
snippet fun
38-
${1:name} = function (${2:variables}) {
38+
${1:name} <- function (${2:variables}) {
3939
${0}
4040
}
4141
snippet ret
@@ -49,7 +49,7 @@ snippet c
4949
snippet li
5050
list(${0:items})
5151
snippet mat
52-
matrix(${1:data}, nrow=${2:rows}, ncol=${0:cols})
52+
matrix(${1:data}, nrow = ${2:rows}, ncol = ${0:cols})
5353

5454
# apply functions
5555
snippet apply
@@ -110,7 +110,7 @@ snippet pl
110110
snippet ggp
111111
ggplot(${1:data}, aes(${0:aesthetics}))
112112
snippet img
113-
${1:(jpeg,bmp,png,tiff)}(filename="${2:filename}", width=${3}, height=${4}, unit="${5}")
113+
${1:(jpeg,bmp,png,tiff)}(filename = '${2:filename}', width = ${3}, height = ${4}, unit = '${5}')
114114
${0:plot}
115115
dev.off()
116116

snippets/tex.snippets

+18-11
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ snippet begin
2121
# Tabular
2222
snippet tab
2323
\begin{${1:tabular}}{${2:c}}
24-
${0}
24+
${0}
2525
\end{$1}
2626
snippet thm
2727
\begin[${1:author}]{${2:thm}}
28-
${0}
28+
${0}
2929
\end{$2}
3030
snippet center
3131
\begin{center}
@@ -34,6 +34,7 @@ snippet center
3434
# Align(ed)
3535
snippet ali
3636
\begin{align${1:ed}}
37+
\label{eq:${2}}
3738
${0}
3839
\end{align$1}
3940
# Gather(ed)
@@ -44,6 +45,7 @@ snippet gat
4445
# Equation
4546
snippet eq
4647
\begin{equation}
48+
\label{eq:${2}}
4749
${0}
4850
\end{equation}
4951
# Equation
@@ -61,6 +63,9 @@ snippet eqnarray
6163
\begin{eqnarray}
6264
${0}
6365
\end{eqnarray}
66+
# Label
67+
snippet lab
68+
\label{${1:eq:}${2:fig:}${3:tab:}${0}}
6469
# Enumerate
6570
snippet enum
6671
\begin{enumerate}
@@ -81,7 +86,7 @@ snippet desc
8186
# Endless new item
8287
snippet ]i
8388
\item ${1}
84-
${0:]i}
89+
${0:]i}
8590
# Matrix
8691
snippet mat
8792
\begin{${1:p/b/v/V/B/small}matrix}
@@ -169,14 +174,18 @@ snippet index
169174
\index{${1:index}} ${0}
170175
#Citations
171176
snippet citen
172-
\cite{$1} ${0}
173-
# bibtex commands
177+
\citen{${1}} ${0}
178+
# natbib citations
174179
snippet citep
175-
\citep{$1} ${0}
180+
\citep{${1}} ${0}
176181
snippet citet
177-
\citet{$1} ${0}
182+
\citet{${1}} ${0}
178183
snippet cite
179184
\cite[${1}]{${2}} ${0}
185+
snippet citea
186+
\citeauthor{${1}} ${0}
187+
snippet citey
188+
\citeyear{${1}} ${0}
180189
snippet fcite
181190
\footcite[${1}]{${2}}${0}
182191
#Formating text: italic, bold, underline, small capital, emphase ..
@@ -203,7 +212,7 @@ snippet ft
203212
snippet fig
204213
\begin{figure}
205214
\begin{center}
206-
\includegraphics[scale=${1}]{Figures/${2}}
215+
\includegraphics[scale=${1}]{Figures/${2}}
207216
\end{center}
208217
\caption{${3}}
209218
\label{fig:${4}}
@@ -230,9 +239,7 @@ snippet sum
230239
snippet lim
231240
\lim_{${1:x \to +\infty}} ${0}
232241
snippet frame
233-
\begin{frame}[<+->]
234-
\frametitle{${1:title}}
235-
242+
\begin{frame}[${1:t}]{${2:title}}
236243
${0}
237244
\end{frame}
238245
snippet block

0 commit comments

Comments
 (0)