Changing the Arduino IDE Indentions

Despite what the students in my Introductory Programming class seem to think, good coding style is actually really important.  Not only does it make it easier for others to work on and debug your code, but it also makes it easier for you to work on it.  For me, the most important thing is indention.  Proper indention lets you line up brackets and easily see what loop or if statement you’re working in.  This gets even more important when the brackets span more than a single page.

The indention in the Arduino IDE drives me nuts since it is only two spaces and that isn’t enough for me to easily distinguish between different indention levels once you get four or five levels in.  There’s no way to change this in the preferences pane so I thought it was a lost hope for awhile.  After poking around, I discovered the additional preferences text file.  This file is found in the bottom of the normal Arduino preferences pane.


After you close the Arduino IDE and open this file, look for a line that says “editor.tabs.size=2” and change the 2 to whatever indention amount you want; I chose four as a good compromise.


Save the file and then reopen the Arduino IDE and now your tabs will be a decent size.  If you want to make changes to previous sketches, you can highlight the entire sketch and then select “Auto Format”.  Below is the sketch with 2 and then 4 space indention.  Small change, big effect.

Image     Image


One thought on “Changing the Arduino IDE Indentions

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s