summaryrefslogtreecommitdiffstats
path: root/.config/nvim/my_snippets/tex.snippets
diff options
context:
space:
mode:
authorYigit Sever2023-08-18 23:42:39 +0300
committerYigit Sever2023-08-18 23:42:39 +0300
commit387e08c52d9752bc839c71119f140ba8435c3d70 (patch)
tree3bb20c0e58ccf1e65ced4cfdfb6459e226a24672 /.config/nvim/my_snippets/tex.snippets
parent14c14cfcc9aeb4bada6d2429162ded2917f26a94 (diff)
downloaddotfiles-387e08c52d9752bc839c71119f140ba8435c3d70.tar.gz
dotfiles-387e08c52d9752bc839c71119f140ba8435c3d70.tar.bz2
dotfiles-387e08c52d9752bc839c71119f140ba8435c3d70.zip
nvim: switch to lazy.nvim
revert this as whole, if you miss the good old days
Diffstat (limited to '.config/nvim/my_snippets/tex.snippets')
-rw-r--r--.config/nvim/my_snippets/tex.snippets172
1 files changed, 0 insertions, 172 deletions
diff --git a/.config/nvim/my_snippets/tex.snippets b/.config/nvim/my_snippets/tex.snippets
deleted file mode 100644
index 727253f..0000000
--- a/.config/nvim/my_snippets/tex.snippets
+++ /dev/null
@@ -1,172 +0,0 @@
1# vim:ft=snippets:
2# https://castel.dev/post/lecture-notes-1/
3
4global !p
5def math():
6 return vim.eval('vimtex#syntax#in_mathzone()') == '1'
7endglobal
8
9snippet template "Basic template" b
10\documentclass[a4paper]{article}
11
12\usepackage[utf8]{inputenc}
13\usepackage[T1]{fontenc}
14\usepackage{textcomp}
15\usepackage{babel}
16\usepackage{amsmath, amssymb}
17
18% figure support
19\usepackage{import}
20\usepackage{xifthen}
21\pdfminorversion=7
22\usepackage{pdfpages}
23\usepackage{transparent}
24
25\begin{document}
26 $0
27\end{document}
28endsnippet
29
30snippet beg "begin{} / end{}" bA
31\\begin{$1}
32 $0
33\\end{$1}
34endsnippet
35
36priority 100
37snippet ... "ldots" iA
38\ldots
39endsnippet
40
41snippet table "Table environment" b
42\begin{table}[${1:htpb}]
43 \centering
44 \caption{${2:caption}}%
45 \label{tab:${3:label}}
46 \begin{tabular}{${5:c}}
47 $0${5/((?<=.)c|l|r)|./(?1: & )/g}
48 \end{tabular}
49\end{table}
50endsnippet
51
52snippet fig "Figure environment" b
53\begin{figure}[${1:htpb}]
54 \centering
55 ${2:\includegraphics[width=0.8\textwidth]{$3}}
56 \caption{${4:$3}}%
57 \label{fig:${5:${3/\W+/-/g}}}
58\end{figure}
59endsnippet
60
61snippet enum "Enumerate" bA
62\begin{enumerate}
63 \item $0
64\end{enumerate}
65endsnippet
66
67snippet item "Itemize" bA
68\begin{itemize}
69 \item $0
70\end{itemize}
71endsnippet
72
73snippet desc "Description" b
74\begin{description}
75 \item[$1] $0
76\end{description}
77endsnippet
78
79snippet on "O(n)" b
80\mathcal{O}(n)
81endsnippet
82
83snippet mk "Math" wA
84$${1}$`!p
85if t[2] and t[2][0] not in [',', '.', '?', '-', ' ']:
86 snip.rv = ' '
87else:
88 snip.rv = ''
89`$2
90endsnippet
91
92snippet dm "Math" wA
93\[
94${1:${VISUAL}}
95.\] $0
96endsnippet
97
98context "math()"
99snippet '([A-Za-z])(\d)' "auto subscript" wrA
100`!p snip.rv = match.group(1)`_`!p snip.rv = match.group(2)`
101endsnippet
102
103context "math()"
104snippet '([A-Za-z])_(\d\d)' "auto subscript2" wrA
105`!p snip.rv = match.group(1)`_{`!p snip.rv = match.group(2)`}
106endsnippet
107
108context "math()"
109snippet // "Fraction" iA
110\\frac{$1}{$2}$0
111endsnippet
112
113context "math()"
114snippet '((\d+)|(\d*)(\\)?([A-Za-z]+)((\^|_)(\{\d+\}|\d))*)/' "Fraction" wrA
115\\frac{`!p snip.rv = match.group(1)`}{$1}$0
116endsnippet
117
118snippet sec "Section"
119\section{${1:${VISUAL:section name}}}%
120\label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
121
122$0
123endsnippet
124
125snippet sec* "Section"
126\section*{${1:${VISUAL:section name}}}%
127\label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
128
129${0}
130endsnippet
131
132
133snippet sub "Subsection"
134\subsection{${1:${VISUAL:subsection name}}}%
135\label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
136
137$0
138endsnippet
139
140snippet sub* "Subsection"
141\subsection*{${1:${VISUAL:subsection name}}}%
142\label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
143
144${0}
145endsnippet
146
147snippet ssub "Subsubsection"
148\subsubsection{${1:${VISUAL:subsubsection name}}}%
149\label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
150
151$0
152endsnippet
153
154snippet ssub* "Subsubsection"
155\subsubsection*{${1:${VISUAL:subsubsection name}}}%
156\label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
157
158${0}
159endsnippet
160
161snippet "mint(ed)?( (\S+))?" "Minted code typeset" br
162\begin{listing}
163\begin{minted}[linenos,numbersep=5pt,frame=lines,framesep=2mm]{${1:`!p
164snip.rv = match.group(3) if match.group(2) is not None else "language"`}}
165${2:${VISUAL:code}}
166\end{minted}
167\caption{${3:caption name}}
168\label{lst:${4:${3/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
169\end{listing}
170
171$0
172endsnippet