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:

http://astyle.sourceforge.net/astyle.html


Copy the formatter.conf file.

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


Example:

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

http://astyle.sourceforge.net/astyle.html

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

mode=c

2 spaces indentation

indent=spaces=2

also indent macros

indent-preprocessor

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

indent-classes
indent-switches
indent-cases
indent-col1-comments

put a space around operators

pad-oper

put a space after if/for/while

pad-header

if you like one-liners, keep them

keep-one-line-statements

remove-comment-prefix

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

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

--style=allman

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:

style=allman

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.