I just found your plugin, and it looks really helpful!
For my needs, I’m trying to simply get a command mapped to a key binding, and have it fold all functions (and only functions) in PHP files, which are structured like:
/**
* Docblock for function.
*/
function example_function($param) {
return $param;
}
The built-in code folding folds all comments, too, which is annoying in my workflow. Therefore I’m trying to add the command “fold_functions”, and I think I’m getting hung up somewhere; it’s not clear if I need to define the ‘fold’ action in the command itself, and then how to run the “fold_functions” command without the key binding (which I might also have set up incorrectly).
Here’s my customizations:
Inside Default.sublime-commands (which Sublime opened when I chose Sublime > Preferences > Package Settings > Reg Replace > Commands - User):
{
{
"caption": "Code Folding: Fold All Functions",
"command": "fold_functions",
"keys": "shift+super+0"],
"args": {"replacements": "fold_functions"], "action": "fold"}
},
}
Inside reg_replace.sublime-settings (which Sublime opened when I chose Sublime > Preferences > Package Settings > Reg Replace > Commands - User):
{
// Fold all functions.
"fold_functions": {
"find": "^function\\b(.*?(\\n))+.*?\\}",
"greedy": false,
"case": false
}
}
It’s a little confusing to me, but I’ve also only started using Sublime a few weeks ago, so I’m trying to understand the system.