sublimetext3

Custom folding for Sublime Text 3


I am trying to get custom folding for sublime text 3, namely the markers:

*--#[
    some stuff
*--#]

indicate my region. I tried AAAPacakgeDev, but it doesn't seem to support folding. The package SyntaxFold introduces its own logic and new keybindings, which seems unnecessary.

It seems .tmLanguage does support folds, so what I did is I copied Obective-C.tmLanguage from its package to Packages\FORM and renamed it to `FORM.tmLanguage'. Then I modified the markers to:

<key>foldingStartMarker</key>
<string>^\*..#\[.*$</string>
<key>foldingStopMarker</key>
<string>^\*..#\].*$</string>

and changed the syntax to FORM. Even though the colors change and the pattern matches when I do a regex on the code, the folds are not working.

What am I doing wrong?


Solution

  • Apparently, this is a long-time requested feature. I found the SyntaxFold package to be a convenient substitute. My configuration file looks like:

        {
            "endMarker": "^\\*..#\\][^\n]*$",
            "name": "Form",
            "startMarker": "^\\*..#\\[[^\n]*$"
        },
    

    I also made the key bindings the same as the normal folds.