vim/ultisnips-bullshit/tex.snippets @ 46fd11ae3808

Merge
author Steve Losh <steve@stevelosh.com>
date Thu, 13 Jun 2024 12:30:10 -0400
parents 9626a177bf66
children (none)
global !p
def math():
  return vim.eval('vimtex#syntax#in_mathzone()') == '1'
endglobal

# Structure -------------------------------------------------------------------
snippet b "An environment" b
\begin{$1}
    $0
\end{$1}
endsnippet

snippet sec "\section*" b
\section*{$1}$0
endsnippet

snippet ssec "\subsection*" b
\subsection*{$1}$0
endsnippet

snippet desc "\begin{description}" b
\begin{description}
    $0
\end{description}
endsnippet

snippet lst "\begin{lstlisting}" b
\begin{lstlisting}
$0
\end{lstlisting}
endsnippet

snippet i "\item[]" b
\item[$1]$0
endsnippet

snippet eq "Equation environment" b
\begin{equation*}
\begin{split}
    $0
\end{split}
\end{equation*}
endsnippet

snippet jot "Set jot length (should go between equation and split envs)" b
\setlength{\jot}{${1:10}pt}$0
endsnippet

# Markup ----------------------------------------------------------------------

snippet href "The hyperref package's \href{}{} command (for url links)"
\href{${1:url}}{${2:display name}}$0
endsnippet

snippet url "A linked URL"
\url{${1:url}}$0
endsnippet

snippet fn "Footnote"
\footnote{${1:Note}}$0
endsnippet

snippet em "\emph{}"
\emph{${1:${VISUAL:}}}$0
endsnippet

# Math ------------------------------------------------------------------------
snippet "(^|[^a-zA-Z])mm" "Inline LaTeX math" rA
`!p snip.rv = match.group(1)`\$ ${1:${VISUAL:}} \$$0
endsnippet

context "math()"
snippet ff "(math) \frac{}{}"
\frac{$1}{$2}$0
endsnippet

context "math()"
snippet rm "(math) \mathrm{}"
\mathrm{$1}$0
endsnippet

context "math()"
snippet __ "(math) _{}" iA
_{ $1 }$0
endsnippet