Auto-indent cursor and closing curly braces


#1

A handy feature in Sublime Text is auto indenting the closing curly brace on [ENTER]. For example, if the cursor is between the curly braces:

function hello()
{
    if (1) {*cursor*}
}

[ENTER] will automatically indent the cursor and closing curly brace:

function hello()
{
    if (1) {
    *cursor*
    }
}

Atom 0.75.0 moves the cursor and closing brace to column 0:

function hello()
{
    if (1) {
*cursor*
}
}

It’s minor but I find myself having to select both lines, indent, hit [ESC] to unselect both lines, and then hit indent again.

All in all, I’m pretty impressed with Atom so far. Thanks!


#2

This is working fine for me. Do you have the correct syntax picked?


#3

No. I was editing QtQuick files which don’t have a syntax and I couldn’t find a CMD-SHIFT-P action to change the syntax like in Sublime Text. I guess I’ll have to modify the javascript package.


#4

there’s a package called ‘file-types’, which works wonderfully for changing default syntaxes.


#5

Handy package indeed. Thanks!