Closed Konfekt closed 3 years ago
there are bugs in this pull request
some snippets inside math() function refuse to work
163 context "math()"
164 snippet '([A-Za-z])(\d)' "auto subscript" wrA
165 `!p snip.rv = match.group(1)`_`!p snip.rv = match.group(2)`
166 endsnippet
this doesn't work but,
164 snippet '([A-Za-z])(\d)' "auto subscript" wrA
165 `!p snip.rv = match.group(1)`_`!p snip.rv = match.group(2)`
166 endsnippet
this works globally i don't really know how math function works but you guys can take a look and can reproduce this bug hopefully.
I cannot reproduce. I have been testing this PR in Vim 8.0.1568
on Linux using this abbreviation
context "math()"
snippet '([A-Za-z])(\d)' "auto subscript" wrA
`!p snip.rv = match.group(1)`_`!p snip.rv = match.group(2)`
endsnippet
and, typing, say a3
, in $*$
(where *
denotes the cursor position) expands to a_3
whereas in $text{*}$
it stays a3
I cannot reproduce. I have been testing this PR in Vim
8.0.1568
on Linux using this abbreviationcontext "math()" snippet '([A-Za-z])(\d)' "auto subscript" wrA `!p snip.rv = match.group(1)`_`!p snip.rv = match.group(2)` endsnippet
and, typing, say
a3
, in$*$
(where*
denotes the cursor position) expands toa_3
whereas in$text{*}$
it staysa3
hey thank you for quick response. i reinstalled vimplug with all other plugins and it worked after all without any issue. hope gilles notices this pull request cause the script no longer functions properly in latest vimtex and thank you for your contribution have a nice day :)
Can confirm that this PR works fine but the original code doesn't.
Can also confirm that this pull request works and the current master doesnt.
Thanks for the fix!! Great job
Seems like there's a much simpler solution but I haven't tried it yet:
def math():
return vim.eval("vimtex#syntax#in_mathzone()") != "0"
. Found here.
Yes, evaluating thisvimtex
function (from https://github.com/lervag/vimtex/pull/1884 ) achieves the same as this PR , but, well, depends on vimtex
.
I updated the code a few days ago, making use of the vimtex functions:
Hello @gillescastel! Thanks for simplifying the code, it looks much cleaner for vimtex
users.
In def env(name)
, I think we're missing a y
somewhere in the return statement?
See also https://github.com/lervag/vimtex/issues/1880