Can you fold a highlighted selection of code?
2 views (last 30 days)
I have enabled cell folding with the double percent signs, %%.
I can click each individual +/- on the left hand side of my script window to expand or fold cells now. I can also right click the window and click 'Fold' or 'Fold all'
I want to fold all cells in a section of a few thousand lines of code in the middle and leave open the rest. There are many cells in this section making the manual process annoying. I was hoping I could highlight a large amount of code with the cursor, and fold any cells in it.
If I try to highlight that large section and click Fold , it only folds one (The last one)
If I highlight the section and click Fold All, everything in the file folds, including things I haven't highlighted.
Is there a way to only fold the cells I have highlighted?
Sean de Wolski on 1 Dec 2014
Edited: Sean de Wolski on 1 Dec 2014
I think the bigger question is why do you have more than 1000 lines in a file?
Consider breaking it out into smaller manageable functions (which could be folded as a whole function) and which can be in a separate file once they're working..