I use a handful of keybinds that enable this behavior.
[code]// Doc block generation.
{
“keys”: “enter”], “command”: “insert_snippet”,
“args”:
{
“contents”: “\n *$0”
},
“context”:
{ "key": "preceding_text", "operator": "regex_contains", "operand": "/\\*{2}$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^$", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "comment.block.documentation.phpdoc.php" }
]
},
{
“keys”: “enter”], “command”: “insert_snippet”,
“args”:
{
“contents”: “*$0\n”
},
“context”:
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s]+$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\*", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "comment.block.documentation.phpdoc.php" }
]
},
{
“keys”: “enter”], “command”: “insert_snippet”,
“args”:
{
“contents”: “$0\n*”
},
“context”:
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s+\\*$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^ .+^\\s]$", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "comment.block.documentation.phpdoc.php" }
]
},
{
“keys”: “enter”], “command”: “insert_snippet”,
“args”:
{
“contents”: “\n*$0”
},
“context”:
{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\s\\* .+^\\s]$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^$", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "comment.block.documentation.phpdoc.php" }
]
},
{
“keys”: “enter”], “command”: “insert_snippet”,
“args”:
{
“contents”: “\n*$0”
},
“context”:
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s]+\\*$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^/$", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "comment.block.documentation.phpdoc.php" }
]
},
{
“keys”: “enter”], “command”: “insert_snippet”,
“args”:
{
“contents”: “\n*$0”
},
“context”:
{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\s\\*$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^$", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "comment.block.documentation.phpdoc.php" }
]
}[/code]