fix: Weird extra jump

This commit is contained in:
Sayantan Santra 2024-03-16 15:55:28 -05:00
parent b6118c1985
commit d426810e81
Signed by: SinTan1729
GPG key ID: EB3E68BFBA25C85F

View file

@ -2,9 +2,9 @@ global !p
# def math():
# return vim.eval('vimtex#syntax#in_mathzone()') == '1'
def itemize_like():
def in_env(lst):
try:
return get_env() in ["itemize", "enumerate"]
return get_env() in lst
except:
return False
def get_env():
@ -19,28 +19,26 @@ endglobal
priority -10
extends tex
context itemize_like()
context in_env(["itemize", "enumerate"])
snippet "\\item\s*\S+.*" "create next item" rb
`!p snip.rv = match.group(0)`
\item $0
endsnippet
context itemize_like()
context in_env(["itemize", "enumerate"])
post_jump "delline_exititemize(snip)"
snippet "\\item\s*$" "exit itemize_like envs" rb
endsnippet
snippet "\\begin\{((?!itemize|enumerate))\}" "multiline begin{} / end{}" rb
snippet "\\begin\{(itemize|enumerate)\}" "multiline begin{} / end{}" rb
\begin{`!p snip.rv = match.group(1)`}
$1
\item $0
\end{`!p snip.rv = match.group(1)`}
endsnippet
snippet "\\begin\{(itemize|enumerate)\}" "multiline begin{} / end{}" rb
snippet "\\begin\{((?!itemize|enumerate))\}" "multiline begin{} / end{}" rb
\begin{`!p snip.rv = match.group(1)`}
\item $1
$0
\end{`!p snip.rv = match.group(1)`}
endsnippet