Open tandrewnichols opened 6 years ago
Was wondering why my vim was being so... slow... I like this solution, the only caveat being that one has to remap all of the z(x)
commands if one wants the full gamut.
Also worth checking out:
This is my setup for folding for some months now. It is extremely fast and I haven't found any bugs. https://github.com/ivangeorgiew/dotfiles/blob/master/.vimrc
You will need https://github.com/Konfekt/FastFold and the function FoldExprJS()
from my vimrc
. Lastly you will need to change s:tabstop
to whatever spacing you use.
If you have questions, let me know. This function was extremely hard to think of btw :D
I spent some time tracking down sudden sluggishness in javascript files to discover it was this plugin (and then of course read the README where it actually says the performance might degrade 🤦♂️), but I think I might have found a workaround for the best of both worlds (I haven't experimented heavily with this, but it seems to be working for folding based on syntax without the normal sluggishness). I'm opening as an Issue rather than a PR just to make sure there aren't flaws in this method that I haven't spotted yet. I'm mapping
<CR>
toza
to fold in normal mode (although the principle here would hold regardless of what mapping you're using), and I set it up like this:So basically turn on syntax-based folding, do the folding, then turn it back off again. Thoughts or any flaws with this approach?