Does Sublime Text 2 have the ability to region code similar to Visual Studio?

There's a request on the official site to "ask for features" here.

But apparently:

FYI, Jon has stated that this is not possible in the current implementation of the editor control. Looks like we're waiting till V3 guys.

Jon being the programmer behind Sublime Text 2.

There might be a way to fake it by creating a plugin that looks for markers and removes the code region in between the markers, but it probably wouldn't look good. With the current API, it's probably your best bet!

By the way, there is some code folding in Sublime Text, if you hover your mouse next to the line number, you will see some arrows appearing when you can fold / unfold.


By default, you can select some code the go to Edit > Code Folding > Fold. There are tons of plugins that leverage the code-folding api for more options.


I ended up using custom comment tags, indented one level less than the code I want to fold. It doesn't look best, though it serves its purpose.

class Foobar {
    // ...some code

// <fold
    function foo() {
    }
    function bar() {
    }
// </fold

    // more code...
}

This (at the moment) folds to:

class Foobar {
    // ...some code

// <fold[...]
// </fold

    // more code...
}

Having a native ST2 support for this would be nice.