Skip to content

Arduino IDE Auto Format configuration

per1234 edited this page Jun 4, 2018 · 2 revisions

The Arduino IDE's Tools > Auto Format feature uses Artistic Style to automatically format sketch code.

Artistic Style is configurable according to your formatting style preferences. The default configuration file is located at {Arduino IDE installation folder}/build/shared/lib/formatter.conf.

Artistic Style configuration options are documented at http://astyle.sourceforge.net/astyle.html. However, that documentation is for the latest release of Artistic Style and Arduino uses an outdated version of Artistic Style (2.05.1) so not all the options documented on that page are usable. You can find version-specific documentation in the doc folder of the Artistic Style downloads at this page: https://sourceforge.net/projects/astyle/files/astyle/.

To customize the Auto Format settings:

  1. Open {Arduino IDE installation folder}/build/shared/lib/formatter.conf in a text editor.
  2. Add/remove/change settings.
  3. Save the file to the folder listed in the Arduino IDE on the line following File > Preferences > More preferences can be edited directly in the file. This is done so your changes will persist through updates of the Arduino IDE.
  4. Restart the Arduino IDE in order for your changes to take effect.