Search code examples
sublimetextsublimetext3bracketscurly-braces

Change Sublime Text 3 Bracket/Indent Rules


In Sublime Text 3, I want to change auto bracket rules. By default, I get this

class  extends Parent implements Interface {

}

but I want this

class  extends Parent implements Interface 
{

}

how can I accomplish this.


Solution

  • You can just create a new snippet, and put it in your user package folder.

    The original snippet that ships with Sublime Text is:

    <snippet>
        <content><![CDATA[class ${1:${TM_FILENAME/(.*?)(\..+)/$1/}} ${2:extends ${3:Parent} }${4:implements ${5:Interface} }{
        $0
    }]]></content>
        <tabTrigger>cl</tabTrigger>
        <scope>source.java</scope>
        <description>javaclass</description>
    </snippet>
    

    You can create a new one and move the opening parenthesis down where you want it

    <snippet>
        <content><![CDATA[class ${1:${TM_FILENAME/(.*?)(\..+)/$1/}} ${2:extends ${3:Parent} }${4:implements ${5:Interface} }
    {
        $0
    }]]></content>
        <tabTrigger>cl</tabTrigger>
        <scope>source.java</scope>
        <description>javaclass</description>
    </snippet>