Format sketch so { and } are placed on separate lines: CTRL T/CMD T

Format your sketches so the { and } are placed on separate lines: use CTRL T or CMD T

With reference to:

Copy the formatter.conf file.

Add this line: >>>>-----> --style=allman


This configuration file contains a selection of the available options provided by the formatting tool "Artistic Style"

If you wish to change them, don't edit this file.

Instead, copy it in the same folder of file "preferences.txt" and modify the copy. This way, you won't lose your custom formatter settings when upgrading the IDE

If you don't know where file preferences.txt is stored, open the IDE, File -> Preferences and you'll find a link


2 spaces indentation


also indent macros


indent classes, switches (and cases), comments starting at column 1


put a space around operators


put a space after if/for/while


if you like one-liners, keep them



#NOTE: the following 4 settings do the same thing so pick one

--style=allman / --style=bsd / --style=break / -A1


Some suggestions:

Your example is attempting to set 4 different styles. Only one of those is going to take effect. They are all just synonyms for the same code style, so it works as you intended, but it is confusing. Pick the style name that makes the most sense to you and use only that one.

I think this tutorial would be improved by you saying where the formatter.conf file is located.

It would also be good to stress that you should save the customized file to the Arduino15 (or similar depending on OS/IDE version) folder so that your changes will persist through IDE updates.

Although the --style=allman approach does work, you might consider using the same configuration style used in the rest of the file:


This will avoid confusion caused by someone trying to understand why the -- is used in one place in the file and not in other places.

You also might consider broadening it to be a general tutorial about customizing the Auto Format tool, rather than specifically about your preferred brace style.

Thanks pert

Things are change in the OP.

Think everything was done.