Skip to content

Tex: de-duplicate ultisnips snippets already defined in snipmate format #1505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ on the fly adding those.
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.

Since UltiSnips supports both UltiSnip and vim-snipmate snippets, when
contributing fixes/new snippets, please prefer adding vim-snipmate snippets.

Related repositories
--------------------

Expand Down
188 changes: 0 additions & 188 deletions UltiSnips/tex.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,6 @@ endglobal
# 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}}
Expand Down Expand Up @@ -135,24 +117,6 @@ snippet fig "Figure environment" bi
\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:${VISUAL}}
Expand Down Expand Up @@ -247,26 +211,6 @@ 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
Expand All @@ -283,34 +227,10 @@ 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
Expand Down Expand Up @@ -467,112 +387,4 @@ snippet ac "Acroynm normal" bi
\ac{${1:acronym}}
endsnippet

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

snippet chapl "Chapter with label" wi
\chapter{$1${VISUAL}}
\label{cha:${2:${1/\W+/-/g}}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are already defined in snipmate, so I removed them, but the labels here are more advanced, so we could leave these in as UltiSnips specific overrides.

endsnippet

snippet secl "Section with label" wi
\section{$1${VISUAL}}
\label{sec:${2:${1/\W+/-/g}}}
endsnippet

snippet sec*l "Section* with label" wi
\section*{$1${VISUAL}}
\label{sec:${2:${1/\W+/-/g}}}
endsnippet

snippet subl "Subsection with label" wi
\subsection{$1${VISUAL}}
\label{sub:${2:${1/\W+/-/g}}}
endsnippet

snippet sub*l "Subsection* with label" wi
\subsection*{$1${VISUAL}}
\label{sub:${2:${1/\W+/-/g}}}
endsnippet

snippet subsubl "Subsection with label" wi
\subsubsection{$1${VISUAL}}
\label{ssub:${2:${1/\W+/-/g}}}
endsnippet

snippet subsub*l "Subsubsection with label" wi
\subsubsection*{$1${VISUAL}}
\label{ssub:${2:${1/\W+/-/g}}}
endsnippet

snippet parl "Paragraph with label" wi
\paragraph{$1${VISUAL}}
\label{par:${2:${1/\W+/-/g}}}
endsnippet

snippet par*l "Paragraph* with label" wi
\paragraph*{$1${VISUAL}}
\label{par:${2:${1/\W+/-/g}}}
endsnippet

snippet subparl "Sub Paragraph with label" wi
\subparagraph{$1${VISUAL}}
\label{subp:${2:${1/\W+/-/g}}}
endsnippet

snippet subpar*l "Sub Paragraph* with label" wi
\subparagraph*{$1${VISUAL}}
\label{subp:${2:${1/\W+/-/g}}}
endsnippet

# vim:ft=snippets:
10 changes: 10 additions & 0 deletions snippets/tex.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,21 @@ snippet par \paragraph
\\paragraph{${1:paragraph name}}%
\\label{par:${2:$1}}
${0}
# Paragraph*
snippet par* \paragraph*
\\paragraph*{${1:paragraph name}}%
\\label{par:${2:$1}}
${0}
# Sub Paragraph
snippet subp \subparagraph
\\subparagraph{${1:subparagraph name}}%
\\label{subp:${2:$1}}
${0}
# Sub Paragraph*
snippet subp* \subparagraph*
\\subparagraph*{${1:subparagraph name}}%
\\label{subp:${2:$1}}
${0}
snippet ni \noindent
\\noindent
${0}
Expand Down