I was in touch with the maintainer of the context.vim syntax file about
this. It turns out to be an issue with the lua.vim file that is included
in the context one. Lua.vim highlights trailing parentheses as errors,
but that’s done in a way that doesn’t work well when the file is
included by other syntax files. It somehow steals the syntax context and
makes Vim stay in Lua mode when it should go back to ConTeXt mode (I’m
not too savvy of the details).
The maintainer came up with a workaround [1] to force returning to
ConTeXt mode, although the parenthesis remains highlighted as an error.
That highlight bothers me, so my own workaround is to copy the lua.vim
file in my own .vim/syntax folder and comment out the ‘syn match
luaParenError ")"’ line (l.61 in my Vim version).
Maybe playing with the ‘contained’ keyword (in lua.vim) could lead to a
proper solution, but I’m happy enough with my workaround that I haven’t
felt the need to investigate this issue any further.
Hope that helps,
Vincent
[1] https://github.com/vim/vim/pull/13778
On 06/01/2024 12:28, Damien Thiriet via ntg-context wrote:
Hello,
Happy New Year!
I got into a bug in my Vim syntax highlighting version.
Highlight stays in lua mode after ctxlua macro is closed.
Here is a MWE, where «this should not be highlitghted as
a comment indeed is.
\starttext
Hello!
\ctxlua{context("does the parser work?")}
-- this should not be highlighted as a comment
\stoptext
Do other Vim users come into this?
Is my syntax file outdated?
I am using this Vim version on OpenBSD 7.3 -stable:
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Sep 6 2023 08:55:14)
Included patches: 1-1876
Best regards,
Damien Thiriet
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry
to the Wiki!
maillist : ntg-context@ntg.nl /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________