Accepted answer

Open Preferences -> Key Bindings-User and add the following:

{ "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n\t$0\n"}, "context":
        { "key": "setting.auto_indent", "operator": "equal", "operand": true },
        { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
        { "key": "preceding_text", "operator": "regex_contains", "operand": "\\($", "match_all": true },
        { "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true }

If the file was previously empty, add square brackets [ ] around the key binding and save. If the file has other custom key bindings, paste it at the beginning just after the opening bracket [, and make sure you add a comma , after it to make sure the file is valid JSON.

Related Query

More Query from same tag