# Possible in Sublime Text to create our own collapsible sections?



## Mike Greene (Jan 22, 2014)

I am loving Sublime Text. One of my favorite features is the ability to collapse sections. (Hopefully that's the right terminology for when you click the arrow at the beginning of "on init" and the entire init callback gets shrunk.) It makes huge scripts so much easier to navigate.

I have a ton of buttons and stuff that would be nice if I could collapse (or hide) all of them at once. I can collapse them individually, of course, but even when collapsed, that's still a long mess. Is it possible for me to somehow insert my own little arrows on the left side, so I can collapse user-selected sections?


----------



## kotori (Jan 22, 2014)

1) Select the code
2) Edit menu -> Code Folding -> Fold

Alternatively you could simply indent the code and you will automatically get the arrow in the margin (you may need to hover over the margin to see it).

-- Nils


----------



## Mike Greene (Jan 22, 2014)

Thanks Nils! 8)


----------



## nosfoe (Jan 24, 2014)

just like Nils said! I also love the folding in sublime text! 
One little addition/specific example I found handy: you can use the way you indent your comments/code to organize where things fold, like this for example:


```
{----  buttons -----}
     code
     code
     code
     code
        {----  green buttons ----}
             code
             code
             code
             code
        {----  blue buttons ----}
             code
             code
             code
{----  sliders -----}
     code
     code
     code
```

This will create folding options for larger or smaller sections.


----------



## polypx (Jan 29, 2014)

I wish I understood a bit more about customizing this plugin. I've managed to add new variables to the list of builtins.data, but that's as far as I've got.

Is it possible to adjust the way it responds to a typed "{" or "if" for example? Or to adjust where the cursor goes after a return key?

Any vague clues much appreciated!

cheers, Dan


----------

