Fold / Collapse the except code section in sublime text 2

If you'll hover with the mouse over the line numbers you'll see arrows - clicking on any of them will fold/collapse the code

enter image description here

enter image description here

If you want to collapse/expand all - you can do so by going to edit->code folding and choose "fold all" or "unfold all":

enter image description here


In addition to the other answers it is also possible to fold based on level as well. So for example looking at the default key bindings for fold.

Subblime key bindings default

Searching for fold key bindings.

searching for fold key bindings in sublime

So for example a foldall, or folding level 1 would be to hold Ctrl followed by pressing the sequence k and then 1:

enter image description here

Or folding level 2 would be to hold Ctrl followed by pressing the sequence k and then 2:

enter image description here

Or unfolding all would be would be to hold Ctrl followed by pressing the sequence k and then 0 or in my defaults I also seem to have it bound to the letter j:

enter image description here

Warning.

Pressing Ctrl+k twice will remove a line or a count of lines. But not really cause you can put them back one by one by Ctrl+u