new: Added snippet to add \item on tab

This commit is contained in:
Sayantan Santra 2024-03-14 14:13:26 -05:00
parent 320d1652ee
commit 916bd301b4
Signed by: SinTan1729
GPG Key ID: EB3E68BFBA25C85F
1 changed files with 16 additions and 0 deletions

View File

@ -1,7 +1,23 @@
global !p
def math():
return vim.eval('vimtex#syntax#in_mathzone()') == '1'
def itemize_or_enumerate():
env = vim.eval('vimtex#env#get_inner()["name"]')
return env in ["itemize", "enumerate"]
endglobal
priority -10
extends tex
context itemize_or_enumerate()
snippet "\\item\s*\S+" "create next item" rb
`!p snip.rv = match.group(0)`
\item $0
endsnippet
snippet "\\begin\{(\w+)\}" "multiline begin{} / end{}" rbA
\begin{`!p snip.rv = match.group(1)`}
$1