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
Highlight \iffalse … \fi as a comment #1988
Comments
It's not a such a bad idea, I think. I'd like a second opinion, though (perhaps @clason?). If we did this, then I think |
Highlighting contents of the I'm not sure about |
Thank you @lervag and @clason for your speedy responses! I would argue that Because VimTeX already supports the use of As for highlighting |
I agree with @clason. Although I don't fully understand the nature of For example, in \let\if@tempswa\iffalse
\def\loop#1\repeat{\def\iterate{#1\relax\expandafter\iterate\fi}%
\iterate \let\iterate\relax} I guess that highlighting the characters between |
@j1-lee This is a good point. What if we only highlighted the contents of I now realize that Given the above, I'm not sure whether or not this is too specialized to be included in VimTeX, given that it would entail handling various edge cases. I had just thought that it would be a convenient quality of life addition, but it seems that this might open up a can of worms; however, I would still be happy to implement it if it is deemed beneficial as a feature to include. Another possibility is to use the approach I detailed previously and just exclude |
I'll look into that!
Thanks for pitching in! I really do appreciate it; it is sometimes hard to decide what is a good idea and what is not - often things may seem like both, and we just have to make a choice.
Perhaps we could add it as an optional highlight? Something like |
Note, the following should suffice for adding syntax region texComment matchgroup=texCmd start="\\iffalse" end="\\fi" |
Thank you @lervag for your thoughtful comments and for 3809599. A few comments:
|
Thanks, fixed :)
I think this is a completely new and separate thread. And I'm not fully sure what you mean: folding is enabled, especially for the
Ah, yes - in this particular case, there is also the problem of nested conditionals: If I add an optional So: to do or not to do add this feature? It seems you are already interested in this, and I would guess it could be of interest to more people. So I'll raise a "why not"?
Ah, good point; I never tested and so never noticed that. My fault. |
I realized that I had not even enabled folding in VimTeX! I had grown used to folding in other languages and just assumed that it was already enabled in VimTeX when I had actually been living without folds. I enabled folding and the
This sounds like a good way to do it. Do you have any idea how to mitigate the additional problem of intervening code in
Thanks! |
Sorry for the delay here! It's been very busy the last month. I just pushed a change that I think might work well in almost every case, so that the option is not necessary. Let me know what you think, and if I'm wrong, I'll be happy to add a switch for this (with default set to off). |
Yes, this fix works well for me. Thank you @lervag! |
Great :) |
The contents after \else should not be highlighted as a comment ref: lervag#1988
Highlight the \else section of \iftrue command as a comment ref: lervag#1988
Similarly to how
c.vim
shipped with Vim highlights anything between#if 0
and#endif
as a comment, it would be nice if VimTeX highlighted anything between\iffalse
and\fi
as a comment, given that these play a similar role in TeX and are a useful way to comment out large swaths of TeX source.In a similar vein, it may be useful to highlight the interior of a
comment
environment (from thecomment
package) as a comment.The text was updated successfully, but these errors were encountered: