Search code examples
emacsspacemacs

spacemacs indent when I press 'o' after "for"


Make an example,when I press 'o' at line 3 of java

public int maximumProduct(int [] nums)
{
    for(int i = 0; i < nums.length; i ++)

}

and I press '{' to make a block, the ident will be like this

public int maximumProduct(int [] nums)
{
    for(int i = 0; i < nums.length; i ++)
        {

        }
}

look that, the braces is look embarrassed. what could I do to solve this problem in spacemacs? If you know please leave a comment, thanks! :)


Solution

  • You didn't provide a whole lot of information, but try pressing ctrl-c ., which runs the command c-set-style, when you're in the buffer containing your Java code and pick anything besides gnu. (I like linux.)

    To learn more, you can use Emacs's built-in help function (SPC h d f c-set-style for spacemacs) or check the wiki: https://www.emacswiki.org/emacs/IndentingC