marshallward / vim-restructuredtext

Syntax file for reStructuredText on Vim.
26 stars 12 forks source link

Folding support. #26

Closed anntzer closed 6 years ago

anntzer commented 6 years ago

Add folding support, as proposed in #25. This was actually surprisingly easy. This is a Python implementation (so perhaps it should be protected by if has('python'), but in truth it "should be" easy to implement a vimscript version as well. (Perhaps you can consider this a proof of concept for now.) A cache is used and updated on-demand because vim calls foldexpr once per line, so it would be (quadratically) wasteful to rescan the buffer from the beginning to get the foldlevel for each line.

marshallward commented 6 years ago

Thanks, this looks great. Sorry for the very long delay here, trying to get some other things finished at the moment but will give it a try soon.

I agree that the has('python') check probably needs to be incorporated. Linux distros almost always has some sort of python installed, but maybe some Windows does not?

anntzer commented 6 years ago

Actually I'll look into rewriting this with vimscript.

marshallward commented 6 years ago

Closing this; I think we're better off with the VimL version.