Changing preferences.txt to 4-space tabs, how to AutoFormat existing code? Title says it all really, but to elaborate, in my preferences.txt file, I've changed the editor.tabs.size variable to 4, which works wonderfully, and now produces 4-space tabs as do my other IDEs for all the languages I write in.

However, I was told that using the Tools-&gt;AutoFormat feature would update all lines in my previously-written sketches that had the standard 2-space tabs with the new 4-space tab layout.

This isn't so. Whether I CTRL-a to select all and run the Auto Format function, or whether I leave everything de-selected, nothing happens.

Should auto-format "fix" the 'incorrect' indenting to the new style? If so, what am I missing?

I'm currently on Arduino IDE 1.8.5 on Linux Mint, if that makes a difference.
The auto formatter (astyle) uses a separate configuration to the editor (crazy, I know, but that's the Arduino mentality for you...).

It uses a separate configuration, which is in the lib folder of your Arduino program, called formatter.conf.


Copy that file to the same location as preferences.txt so it doesn't get overwritten when you upgrade the IDE.
Edit the file and change indent=spaces=2 to indent=spaces=4


The auto format should now be the same as the editor format.