bsegraves / custom-folds

Atom plugin for defining custom markers for foldable regions.
MIT License
24 stars 9 forks source link

Custom Folds

An Atom plugin for defining custom markers for foldable regions.

This plugin was inspired by Visual Studio's treatment of C#'s #region tags.

Usage

In the plugin's settings, you can define custom text that identifies the start and end of a foldable section of code.

By default, a comment starting with <editor-fold identifies the start of a foldable region and another comment starting with </editor-fold> marks the end of that region. These default settings were only chosen because the author works on a team where a few "special" engineers insist on using JetBrain's WebStorm IDE. These tags allow both sets of engineers (those using Atom and those using WebStorm) to have the same foldable regions of code.

But you don't need to be working with people that insist on using WebStorm. You can configure the starting and ending tags to whatever you want. This allows you to create your own, custom, collapsible regions.

The folding is recursive, so you can have regions within regions within regions.

Highlighting of these foldable tags is also enabled by default. This can be easily disabled from the package's Settings screen.

Image of highlighting

There is also an option to auto-fold files on load. This can be enabled from the package's settings.

Commands

Tips

Personally I use the following snippet for creating new foldable regions.

"editor-fold":
    "prefix": "// e"
    "body": "// <editor-fold desc='$1'>\n// </editor-fold>"`

License

See LICENSE for details.