I coded a little plugin this weekend that lets you do code folding. The way it works is you select some text and hit the "fold" shortcut, and the text gets grabbed from the buffer and replaced with a fold marker. If you select some or all of the fold marker and hit "unfold", the fold marker gets replaced with the text in the buffer. It's actually kind of cool, if I do say so myself.
It also works nice with saving: whenever you save, the fold markers all get replaced with the original text, and then get folded back again after the save. The file on the disk will always have the full text.
Anyway, check it out here:
github.com/adzenith/Sublime-plu ... folding.py
The one known bug is that whenever you save a view, it seems to scroll down about 1 line—it turns out that view.show(view.visible_region(),False) moves the view.
Also, if you're doing some hacking at home, keep in mind that if you ever save code_folding.py from within Sublime Text, the plugin will be reloaded and it will forget all the text that it's grabbed from buffers, making it impossible to unfold text.
As always, feedback and comments are appreciated.