Open khughitt opened 9 years ago
@khughitt Are you working on a Pandoc document or similar with a front matter? Is it possible that you have an unclosed YAML front matter in your document. Pandoc, for instance, has a weird front matter that opens with --- and closes with ..., and this plugin won't recognize that. At least for me this was the issue. Even if this is not the case for you, you may want to check to see if there is something in your text that this plugin considers as opening a block, and that is not followed by a bock-closing sign.
@retrography I am indeed using Pandoc to convert the Markdown to PDF, and am including a YAML header. As far as I can tell though, it should be properly closed.
The YAML block for the document is:
---
bibliography: references.bib
header-includes:
- \usepackage[font=small,labelfont=bf]{caption}
- \usepackage{wrapfig}
- \usepackage{framed}
- \pagenumbering{gobble}
output:
pdf_document
---
There is one other instance in the document of a long string of dashes used to create a header item (-----------), and I found one instance of '...' in a comment in the document.
It's been a while since I worked on that document, however, and when I tried to reproduce the issue just now I was unable to.
I'll re-enable folding though and let you know if I run into the problem again.
Feel free to close this issue in the meantime if you would prefer.
Thanks!
Is there any workaround for this?
I'm writing a small script to help me with pandoc-markdown-jekyll (it parses the whole file while making changes along the way with setline
) but Foldexpr_markdown
takes too much time (~ 15 seconds for a ~ 750 lines file).
And it doesn't matter if the frontmatter closure is set to '...' or '---'.
I also tried let g:vim_markdown_folding_disabled = 1
in my script but no luck.
The only workaround I found so far was using let g:vim_markdown_folding_disabled = 1
in .vimrc. But this disables folding altogether.
BTW, Pandoc's YAML closure is valid. More info on this at https://github.com/jgm/pandoc/pull/2668
:setl foldexpr=0
to disable folding of current buffer.
let g:vim_markdown_folding_disabled = 1
at runtime doesn't work.
Thanks! That solved it.
Just wondering if there is a way to save and restore the foldexpr value in vimscript?
I can save the value with let orgfoldexpr=&foldexpr
but I'm unable to restore it afterwards.
&foldexpr
seems to be string.
setl foldexpr=eval(orgfoldexpr)
restores the string value.
Works like a charm. Thanks.
Can this issue be reopened? Disabling folding seems to be a work-around, not a solution…
I am observing sluggish typing in this file:
https://github.com/nomeata/haskell-for-readers/blob/a593b822a0a19fdc5f9aa38ff848225179381167/haskell-for-readers.md
and it works better after :setl foldexpr=0
.
Use let g:vim_markdown_folding_disabled = 1
works for me.
I'm also observing significantly laggy performance in modestly large (5000 line) files that resolves when folding is disabled (but I would really like to be able to use folding!).
When working on a mixed Markdown/LaTeX document, I noticed after a while the performance of very basic actions like deleting a word or pasting text was becoming very slow.
I profiled vim to see what the culprit was, and it turned out the be the vim-markdown (commit 091091fdf8f1f7f42bf1a183eab100f923928841 from 2015/01/02)
Foldexpr_markdown
function. After just a few seconds of profiling and performing basic text manipulation operations on a paragraph of plain-text,Foldexpr_markdown
was called over 100,000 times:To be sure that this was indeed the issue, I disabled vim-markdown folding using
let g:vim_markdown_folding_disabled=1
and the issue went away.Unfortunately I am not sure how to reproduce the issue outside of the larger document I am working on, so I cannot pinpoint the cause of the problem.
The document is not all that special, except that is contains a couple simple LaTeX equations and images. The image blocks are the most complex bit of LaTeX, and they look something like:
Vim version: VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 27 2014 04:46:10) Included patches: 1-560
I'm sorry I can't provide a more reproducible example. Hopefully this might give you some ideas about the underlying issue, or perhaps someone else with the same problem can help to clarify.
Let me know if there is anything else I can do to help track down the issue.