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