Modifying new sketch basic syntax

Hello everyone,

I’ve been playing and enjoying Arduino for about a year now, I’m getting more confident with it and with coding (i’m quite new at this but love it !).

I’m using Arduino IDE 1.8.5, on Ubuntu 16.04.

So right to the point, I’m not very happy with the “basic syntax” when opening a new sketch on the IDE, let me explain myself.
I’d prefer having the braces broken down, rather than attached to the first line. I would also like to have a kind of clearer “skeleton” when opening a new sketch (e.g : adding standard comments such as “VARIABLES”, “SETUP”, “LOOP”, “FUNCTIONS” to identify every part of the program …, I’ve attached a screenshot of what I would like to do).
I’ve been googling a bit, I’ve found that I can modify certain options with the preferences.txt files, and I also came across “Artistic Style” formatting (Artistic Style), which I tried to implement in the “formatter.conf” file, but it didn’t work.

So, I’d like to know where or how I can modify the brace style option, and where I could insert a “code skeleton” so that it would appear everytime I open a New Sketch with the IDE ?

Thanks in advance for your reply,

Astyle is only used for Tools > Auto Format. formatter.conf is the right file to modify to change the behavior of Auto Format. You need to restart the Arduino IDE before changes you make there take effect. Also note that Arduino is using an older version of Astyle, 2.05.1 so not all the options you see in the documentation will work in the Arduino IDE. You can see which options were added since 2.05.1 in the Astyle release notes:

But if you just want to change the sketch that appears when you do File > New, then formatter.conf won't do anything for you. Instead you need to open the file {Arduino IDE installation folder}/Examples/01.Basics/BareMinimum/BareMinimum.ino in a text editor and make the changes you want. Note that you will need to redo this change whenever you update to a new version of the Arduino IDE.

Thanks very much Pert for your answer, I managed to modify the "Bareminimum" file to my wish.

I'm having troubles modifying the formatter.conf file though, not sure to fully understand how to do it.

I basically want to add the "brace style Broken" option, i added this line in the file "--style=Broken", but it's not working (i made a copy of the original formatter.conf file and restarted the IDE).

Would you have any advice ?


I don't see a --style=broken option listed anywhere in the Astyle documentation. I think you mean --style=break. You need to leave the -- part off. So if you add this line to your formatter.conf:


Save the file, then restart the Arduino IDE, then do a Tools > Auto Format on a sketch that has attached braces they will be converted to the broken brace style.

Thanks so much !

I finally managed to do it, I wasn't aware of the autoformat tool in the IDE.

Well, i'm trying different brace styles, i'll choose the one that suits me best.

Thanks again !