-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility for builtin syntax groups #1883
Comments
For completeness, @Konfekt opened a very related issue #1882. I decided to close that one and continue the discussion here.
I've started this, see the updated Wiki page here.
Yes, that might be a good solution. Let's first agree on which groups are relevant and necessary, then I'll add this function/option. |
This linkage as given in the Wiki might restore compatibility with tex-conceal but the function that checks for a math zone by the built-in highlight groups still no longer works: function! IsMath()
return match(map(synstack(line('.'), max([col('.') - 1, 1])),
\ 'synIDattr(v:val, ''name'')'), '^texMathZone\%([A-L]S\?\|[V-Z]\)$') >= 0
endfunction |
Hmm. I don't think this trick will work, actually. With that, I think it seems like the |
Fixed. It needs to follow linked groups by return match(map(synstack(line('.'), max([col('.') - 1, 1])),
\ 'synIDattr(synIDtrans(v:val), ''name'')'), '^texMathZone\%([A-L]S\?\|[V-Z]\)$') >= 0 |
Does that also work without the links? |
Yes!
At least it solves #1880 |
No, it does not. |
My understanding is this:
So, it still seems we are not really fixing anything right now. But I'll be glad to learn I'm wrong! |
And what about defining the new groups at the syntax level with something like |
I don't think that would work. Clusters don't work that way; they are used as arguments for No, for the desired compatibility, we actually do need to create duplicate syntax rules (if I understand things correctly, and I might not). If I'm right, then this is not something I think is really viable. |
I agree. Thus, have mercy on the user and keep the syntax group names? (Even though the new names are obviously more pertinent, but backward compatibility is a valuable good.) |
No, sorry, I wont keep the old syntax group names in general. I find the value of consistent group names much higher than the value of "backward" compatibility. But ok, let's say I did agree to revert the change of |
What do you think, @clason? |
That is, without compatibility, all code building on the TeX math syntax group names would have to be doubled from now on. |
No, it won't solve #1881, because that is a much more fundamental issue.
I don't understand quite what you mean with "all code building". How common is this? I do know of the specific |
I have no preference for @Konfekt Note that even if the names are kept, the groups themselves are different now so And I strongly agree that the new syntax groups -- no matter their name, although that is a part of it for some groups at least -- are a significant improvement with practical benefits. I don't think you can have it both ways: vimtex's improved syntax highlighting and full backward compatibility. Luckily, it's easy to choose between the two with the mentioned option so you can keep using both vimtex (for everything else) and tex-conceal (based on the legacy syntax file). So there's no doubling needed. So I guess there's not much to do here after all... |
I do not know of any more examples. All code building on it just wanted to emphasize that it is not known which code builds on it.
This simplifcation would be much appreciated. |
I'm implementing this change now and pushing it with a version bump to 2.1; the change is documented also in the release notes. |
Should I adapt the Wiki, too? |
Ah, yes please (and thanks for the reminder; I would have forgot about that!). |
done! |
Could concealing for |
Yes, I think that should be quite straightforward. I'll look into it when I get the time. |
Vimtex 2.0 ships with a new syntax plugin with more consistent and structured syntax and highlight groups; this overrides the built-in syntax file (by default, unless
let g:vimtex_syntax_enabled=0
disables the new syntax file and reverts to the old one).However, it seems that other plugins rely on the specific groups and their names of the original syntax; see #1881 . To enable these, one can manually link the new groups to the old groups with, e.g.,
hi link texMathZoneZ texMathRegionEnsured
.It would be helpful to add a list of such commands to get back (as close as possible) to the old groups to the Wiki.
Even more convenient would be a function, e.g.,
vimtex#syntax#compat#set_groups()
(or even an optiong:vimtex_syntax_compat
) that can be used to set these links from yourvimrc
/init.vim
.The text was updated successfully, but these errors were encountered: