-
Notifications
You must be signed in to change notification settings - Fork 391
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
Folding interaction with commented command definitions #2668
Comments
Thanks, that is fixed now!
Ah, yes. I would not really call this a bug, though; rather an unintended side effect of the marker folding. The question here is how to treat this particular case? Now we recognize the markers as long as they are inside a comment. The open/close markers are configurable, see Do you have any suggestion that makes more sense than the current? |
It looks like a bug, if one does not understand what is going on under the hood. For me VimTeX expression folding of preamble was simply not working. In essentially all my TeX files the preamble stopped at seemingly random location. It was hard to find the reason for this, since I did not expect that marker and expression folding are mixed in VimTeX, in pure vim they are separate folding methods. (Also, previously, I used marker folding with markers '%<<<' and '%>>>', and forgot that standard vim foldmarks are '{{{, }}}'. )
I know, it is great how configurable the folding is.
It is not an easy question. It is probably difficult to fix it to make everybody happy. I do not know how frequently the mixed folding (expressions/markers) is used. Otherwise I would say, one should follow the vim way and make expression and marker folding separate folding methods. |
Yes, I can understand that!
Agreed. :)
Yes, so, we have three options:
I tend towards option 1, because VimTeX has become quite stable the last 5 years and there's not been many complaints on this part (I believe you may be the first). So, in your case, you can easily fix the problem by disabling marker folding on your end or change the markers. If, instead, I went for option 2 or 3, I risk breaking the expected behaviour for current users of VimTeX. I don't mind breaking things if I have a strong opinion or believe that it is for a greater good. Unless you have a convincing argument for changing this or a better option, I'll leave this as "won't fix". |
Description
When using
foldmethod=expr
, folding (in particular in the preamble) breaks when the file contains lines likevimtex#fold#level()
function returnss1
for such lines, since they match the regular expression for the fold-end marker%.*}}}
, as defined inautoload/vimtex/fold/markers.vim
While debugging this, I also found that there is probably a typo in
autoload/vimtex/fold/markers.vim
in functions:folder_level()
, whereself
should be used instead ofs:self
. Otherwise thevimtex#fold#level()
actually finishes with error and returns-1
Steps to reproduce
No response
Expected behavior
No response
Actual behavior
No response
Do you use a latexmkrc file?
No
VimtexInfo
The text was updated successfully, but these errors were encountered: