fix: Weird extra jump
This commit is contained in:
parent
b6118c1985
commit
d426810e81
1 changed files with 8 additions and 10 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue