Brian Gottier 6 years ago • updated by Алексей Марчук 4 years ago 3
It is very common for a closing parenthesis in PHP to indent to the same level as the line above it, but Sublime adds another tab. It would be great if Sublime would move the indent to the same level as the first line.

Here are some examples of what I believe you mean:

Expected behavior

Actual behavior

A fix is available, but this should really be part of ST2.

As the above link is not available anymore, it’s content here:

Add to your User Keybindings:

    { "keys": ["enter"], "command": "run_macro_file", "args": {"file": "res://Packages/User/Add Line in Braces.sublime-macro"}, "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": "array\\($", "match_all": true },
         { "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true }

Then this file ~/Library/Application Support/Sublime Text 3/Packages/User/Add Line in Braces.sublime-macro with the following content:

    {"command": "insert", "args": {"characters": "\n\n"} },
    {"command": "left_delete", "args": null},
    {"command": "move", "args": {"by": "lines", "forward": false} },
    {"command": "move_to", "args": {"to": "hardeol", "extend": false} },
    {"command": "reindent", "args": {"single_line": true} }
Hi, i tried this (Sublime 3), but when I do reindent of a whole file it doesn't works, but works, when I press enter while creating array. I used to reindent my files often and want to use Sublime :(