From 85004a6c6008067bf1f86d9a411c7d68114bafd6 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Tue, 6 May 2014 08:41:56 +0200 Subject: [PATCH 1/4] add snippet descriptions --- UltiSnips/tex.snippets | 2 +- UltiSnips/vim.snippets | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/UltiSnips/tex.snippets b/UltiSnips/tex.snippets index c32d21f..9ce807e 100644 --- a/UltiSnips/tex.snippets +++ b/UltiSnips/tex.snippets @@ -8,7 +8,7 @@ snippet "b(egin)?" "begin{} / end{}" br \end{$1} endsnippet -snippet tab +snippet tab "tabular / array environment" \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)/}} diff --git a/UltiSnips/vim.snippets b/UltiSnips/vim.snippets index 2e25ffd..29a684a 100644 --- a/UltiSnips/vim.snippets +++ b/UltiSnips/vim.snippets @@ -9,14 +9,14 @@ if !exists("g:${1:MyUltraImportantVar}") endif endsnippet -snippet guard +snippet guard "script reload guard" if exists('${1:did_`!p snip.rv = snip.fn.replace('.','_')`}') || &cp${2: || version < 700} finish endif let $1 = 1${3} endsnippet -snippet f +snippet f function fun ${1:function_name}(${2}) ${3:" code} endf From da157ef0793435ac3026cc6cbfa3ea7f595687e7 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Tue, 6 May 2014 09:16:15 +0200 Subject: [PATCH 2/4] add snippet descriptions --- snippets/tex.snippets | 136 +++++++++++++++++++++--------------------- snippets/vim.snippets | 20 +++---- 2 files changed, 78 insertions(+), 78 deletions(-) diff --git a/snippets/tex.snippets b/snippets/tex.snippets index 8304953..37fcc91 100644 --- a/snippets/tex.snippets +++ b/snippets/tex.snippets @@ -1,215 +1,215 @@ #PREAMBLE #newcommand -snippet nc +snippet nc \newcommand \newcommand{\${1:cmd}}[${2:opt}]{${3:realcmd}} ${0} #usepackage -snippet up +snippet up \usepackage \usepackage[${1:options}]{${2:package}} ${0} #newunicodechar -snippet nuc +snippet nuc \newunicodechar \newunicodechar{${1}}{${2:\ensuremath}${3:tex-substitute}}} ${0} #DeclareMathOperator -snippet dmo +snippet dmo \DeclareMathOperator \DeclareMathOperator{${1}}{${2}} ${0} #DOCUMENT # \begin{}...\end{} -snippet begin +snippet begin \begin{} ... \end{} block \begin{${1:env}} ${0} \end{$1} # Tabular -snippet tab +snippet tab tabular (or arbitrary) environment \begin{${1:tabular}}{${2:c}} ${0} \end{$1} -snippet thm +snippet thm thm (or arbitrary) environment with optional argument \begin[${1:author}]{${2:thm}} ${0} \end{$2} -snippet center +snippet center center environment \begin{center} ${0} \end{center} # Align(ed) -snippet ali +snippet ali align(ed) environment \begin{align${1:ed}} \label{eq:${2}} ${0} \end{align$1} # Gather(ed) -snippet gat +snippet gat gather(ed) environment \begin{gather${1:ed}} ${0} \end{gather$1} # Equation -snippet eq +snippet eq equation environment \begin{equation} \label{eq:${2}} ${0} \end{equation} # Equation -snippet eq* +snippet eq* unnumbered equation environment \begin{equation*} ${0} \end{equation*} # Unnumbered Equation -snippet \ +snippet \ unnumbered equation: \[ ... \] \[ ${0} \] # Equation array -snippet eqnarray +snippet eqnarray eqnarray environment \begin{eqnarray} ${0} \end{eqnarray} # Label -snippet lab +snippet lab \label \label{${1:eq:}${2:fig:}${3:tab:}${0}} # Enumerate -snippet enum +snippet enum enumerate environment \begin{enumerate} \item ${0} \end{enumerate} # Itemize -snippet itemize +snippet itemize itemize environment \begin{itemize} \item ${0} \end{itemize} -snippet item +snippet item \item \item ${1} # Description -snippet desc +snippet desc description environment \begin{description} \item[${1}] ${0} \end{description} # Endless new item -snippet ]i +snippet ]i \item (recursive) \item ${1} ${0:]i} # Matrix -snippet mat +snippet mat smart matrix environment \begin{${1:p/b/v/V/B/small}matrix} ${0} \end{$1matrix} # Cases -snippet cas +snippet cas cases environment \begin{cases} ${1:equation}, &\text{ if }${2:case}\\ ${0} \end{cases} # Split -snippet spl +snippet spl split environment \begin{split} ${0} \end{split} # Part -snippet part +snippet part document \part \part{${1:part name}} % (fold) \label{prt:${2:$1}} ${0} % part $2 (end) # Chapter -snippet cha +snippet cha \chapter \chapter{${1:chapter name}} \label{cha:${2:$1}} ${0} # Section -snippet sec +snippet sec \section \section{${1:section name}} \label{sec:${2:$1}} ${0} # Section without number -snippet sec* +snippet sec* \section* \section*{${1:section name}} \label{sec:${2:$1}} ${0} # Sub Section -snippet sub +snippet sub \subsection \subsection{${1:subsection name}} \label{sub:${2:$1}} ${0} # Sub Section without number -snippet sub* +snippet sub* \subsection* \subsection*{${1:subsection name}} \label{sub:${2:$1}} ${0} # Sub Sub Section -snippet subs +snippet subs \subsubsection \subsubsection{${1:subsubsection name}} \label{ssub:${2:$1}} ${0} # Sub Sub Section without number -snippet subs* +snippet subs* \subsubsection* \subsubsection*{${1:subsubsection name}} \label{ssub:${2:$1}} ${0} # Paragraph -snippet par +snippet par \paragraph \paragraph{${1:paragraph name}} \label{par:${2:$1}} ${0} # Sub Paragraph -snippet subp +snippet subp \subparagraph \subparagraph{${1:subparagraph name}} \label{subp:${2:$1}} ${0} -snippet ni +snippet ni \noindent \noindent ${0} #References -snippet itd +snippet itd description \item \item[${1:description}] ${0:item} -snippet figure +snippet figure reference to a figure ${1:Figure}~\ref{${2:fig:}} -snippet table +snippet table reference to a table ${1:Table}~\ref{${2:tab:}} -snippet listing +snippet listing reference to a listing ${1:Listing}~\ref{${2:list}} -snippet section +snippet section reference to a section ${1:Section}~\ref{sec:${2}} ${0} -snippet page +snippet page reference to a page ${1:page}~\pageref{${2}} ${0} -snippet index +snippet index \index \index{${1:index}} ${0} #Citations -snippet citen +snippet citen \citen \citen{${1}} ${0} # natbib citations -snippet citep +snippet citep \citep \citep{${1}} ${0} -snippet citet +snippet citet \citet \citet{${1}} ${0} -snippet cite +snippet cite \cite[]{} \cite[${1}]{${2}} ${0} -snippet citea +snippet citea \citeauthor \citeauthor{${1}} ${0} -snippet citey +snippet citey \citeyear \citeyear{${1}} ${0} -snippet fcite +snippet fcite \footcite[]{} \footcite[${1}]{${2}}${0} #Formating text: italic, bold, underline, small capital, emphase .. -snippet it +snippet it italic text \textit{${0:text}} -snippet bf +snippet bf bold face text \textbf{${0:text}} -snippet under +snippet under underline text \underline{${0:text}} -snippet emp +snippet emp emphasize text \emph{${0:text}} -snippet sc +snippet sc small caps text \textsc{${0:text}} #Choosing font -snippet sf +snippet sf sans serife text \textsf{${0:text}} -snippet rm +snippet rm roman font text \textrm{${0:text}} -snippet tt +snippet tt typewriter (monospace) text \texttt{${0:text}} #misc -snippet ft +snippet ft \footnote \footnote{${0:text}} -snippet fig +snippet fig figure environment (includegraphics) \begin{figure} \begin{center} \includegraphics[scale=${1}]{Figures/${2}} @@ -218,7 +218,7 @@ snippet fig \label{fig:${4}} \end{figure} ${0} -snippet tikz +snippet tikz figure environment (tikzpicture) \begin{figure} \begin{center} \begin{tikzpicture}[scale=${1:1}] @@ -230,31 +230,31 @@ snippet tikz \end{figure} ${0} #math -snippet stackrel +snippet stackrel \stackrel{}{} \stackrel{${1:above}}{${2:below}} ${0} -snippet frac +snippet frac \frac{}{} \frac{${1:num}}{${2:denom}} ${0} -snippet sum +snippet sum \sum^{}_{} \sum^{${1:n}}_{${2:i=1}} ${0} -snippet lim +snippet lim \lim_{} \lim_{${1:x \to +\infty}} ${0} -snippet frame +snippet frame frame environment \begin{frame}[${1:t}]{${2:title}} ${0} \end{frame} -snippet block +snippet block block environment \begin{block}{${1:title}} ${0} \end{block} -snippet alert +snippet alert alertblock environment \begin{alertblock}{${1:title}} ${0} \end{alertblock} -snippet example +snippet example exampleblock environment \begin{exampleblock}{${1:title}} ${0} \end{exampleblock} -snippet col2 +snippet col2 two-column environment \begin{columns} \begin{column}{0.5\textwidth} ${1} diff --git a/snippets/vim.snippets b/snippets/vim.snippets index c1b802a..b299f51 100644 --- a/snippets/vim.snippets +++ b/snippets/vim.snippets @@ -1,47 +1,47 @@ -snippet header +snippet header standard Vim script file header " File: ${1:`expand('%:t')`} " Author: ${2:`g:snips_author`} " Description: ${3} ${0:" Last Modified: `strftime("%B %d, %Y")`} -snippet guard +snippet guard script reload guard if exists('${1:did_`vim_snippets#Filename()`}') || &cp${2: || version < 700} finish endif let $1 = 1${0} -snippet f +snippet f function fun! ${1:`expand('%') =~ 'autoload' ? substitute(matchstr(expand('%:p'),'autoload/\zs.*\ze.vim'),'[/\\]','#','g').'#' : ''`}${2:function_name}(${3}) ${0} endf -snippet t +snippet t try ... catch statement try ${1} catch ${2} ${0} endtry -snippet for +snippet for for ... in loop for ${1} in ${2} ${0} endfor -snippet forkv +snippet forkv for [key, value] in loop for [${1},${2}] in items(${3}) ${0} unlet $1 $2 endfor -snippet wh +snippet wh while loop while ${1} ${0} endw -snippet if +snippet if if statement if ${1} ${0} endif -snippet ife +snippet ife if ... else statement if ${1} ${2} else ${0} endif -snippet au +snippet au augroup ... autocmd block augroup ${1:AU_NAME} " this one is which you're most likely to use? autocmd ${2:BufRead,BufNewFile} ${3:*.ext,*.ext3|} ${0} From 27c2c2ba7beb2ee8ac861eb34206599fa016f5b5 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Tue, 6 May 2014 14:52:35 +0200 Subject: [PATCH 3/4] add quotation marks --- UltiSnips/vim.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/vim.snippets b/UltiSnips/vim.snippets index 29a684a..fc8f9e1 100644 --- a/UltiSnips/vim.snippets +++ b/UltiSnips/vim.snippets @@ -16,7 +16,7 @@ endif let $1 = 1${3} endsnippet -snippet f function +snippet f "function" fun ${1:function_name}(${2}) ${3:" code} endf From 2672bde2fb1d9846ead1fa3285f451f0d71957c6 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Tue, 6 May 2014 14:53:52 +0200 Subject: [PATCH 4/4] add snippet options to some snippets --- UltiSnips/tex.snippets | 2 +- UltiSnips/vim.snippets | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/UltiSnips/tex.snippets b/UltiSnips/tex.snippets index 9ce807e..ede9090 100644 --- a/UltiSnips/tex.snippets +++ b/UltiSnips/tex.snippets @@ -8,7 +8,7 @@ snippet "b(egin)?" "begin{} / end{}" br \end{$1} endsnippet -snippet tab "tabular / array environment" +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)/}} diff --git a/UltiSnips/vim.snippets b/UltiSnips/vim.snippets index fc8f9e1..dbb2396 100644 --- a/UltiSnips/vim.snippets +++ b/UltiSnips/vim.snippets @@ -3,20 +3,20 @@ priority -50 ########################################################################### # SnipMate Snippets # ########################################################################### -snippet gvar "Global / configuration variable" +snippet gvar "Global / configuration variable" b if !exists("g:${1:MyUltraImportantVar}") let g:$1 = ${2:"${3:}"} endif endsnippet -snippet guard "script reload guard" +snippet guard "script reload guard" b if exists('${1:did_`!p snip.rv = snip.fn.replace('.','_')`}') || &cp${2: || version < 700} finish endif let $1 = 1${3} endsnippet -snippet f "function" +snippet f "function" b fun ${1:function_name}(${2}) ${3:" code} endf