Automatic folding with the vimtex plugin is unbearably slow.
Is there anything I can do to speed this up? I tried installing the fastfold plugin but that did nothing I could notice.
First: Did you bother to read the vimtex documentation, i.e. :h vimtex-folding? The docs clearly point out that the fold-expr method of folding is slow, and so therefore provides an option g:vimtex_fold_manual which if enabled (set to nonzero value) will set foldmethod=manual, and instead will remap zx and zX to recalculate the folds when necessary (typically not very often).
The fastfold plugin is a very good alternative, as it will automatically ensure that the foldmethod is set to manual. This will also work for other file types, and the plugin provides a set of possibilities for when the folds should be refreshed.
Disclaimer: I am the developer of vimtex.
foldtext with set foldtext=, which should show line numbers. Also, I personally don't have any problems with long load times that I've noticed. You could consider to open an issue and explain the problem and how to reproduce.
– Karl Yngve Lervåg
Feb 10 '16 at 08:29
foldmethod=marker. Of course, then you'd have to use a foldmarker (e.g. {{{,}}} or F{O{L{D,F}O}L}D) in tex documents, but it does make it faster.
– mahbubweb
May 20 '20 at 20:03
g:vimtex_fold_manual.
– Karl Yngve Lervåg
May 21 '20 at 06:12
mkviewandloadview. See Can I save folds? – Steve Feb 09 '16 at 12:25ftplugin/tex.vim:setlocal foldmethod=marker,setlocal foldmarker=(fold),(end)andsetlocal commentstring=\ %\ %s. In addition to this I use snippets which all have% (fold),% (end)pairs – Steve Feb 09 '16 at 13:53% (fold/end)and I got used to it, so I now prefer how it looks. Think that's about it afaik – Steve Feb 09 '16 at 14:15