I'd like my Arduino IDE to use spaces instead of tabs. I've modified my preferences.txt file (I'm running under 64-bit Win7 Pro BTW, it it matters) and I've set:
editor.tabs.size=4
Indentation is now set to 4 spaces. What I'd like to do now is to use tabs instead of spaces. Ho do I set up the IDE to use tabs?
So, this topic was made in 2012 and it looks like the Arduino IDE hasn't been fixed yet. Is the tab button still broken or what? I can't seem to make tabs work. Instead, the IDE replaces the tab with spaces, which is retarded.
Select File > Preferences from the Arduino IDE menus.
The "Preferences" dialog will open.
Click the link on the line following "More preferences can be edited directly in the file" in the "Preferences" dialog.
This will open a folder named something like "Arduino15" (depending on your operating system) in your file browser.
Switch back to the Arduino IDE window.
Select File > Quit from the Arduino IDE menus.
Arduino IDE overwrites the preferences file on exit, so it is necessary to exit Arduino IDE before manually editing preferences so that the IDE won't overwrite your changes.
Switch back to the file browser window that has the "Arduino15" folder open.
Use any text editor to open the preferences.txt file you find in that folder.
Change the line:
editor.tabs.expand=true
to:
editor.tabs.expand=false
Save and close the preferences.txt file.
Start Arduino IDE.
You will now find Arduino IDE uses tabs for indentation.
Thanks, pert! I appreciate that! I tried to do that earlier today and nothing changed. I retried about three or so more times (with the IDE closed) and it finally stuck and now I have actual tabspaces.
Unfortunately, auto-format still changes everything back to spaces.
Select File > Quit from the Arduino IDE menus if it's running.
Use any text editor to open the file at the following path:
<IDE installation folder>/lib/formatter.conf
(where <IDE installation folder> is the folder where Arduino IDE is installed on your computer)
Edit the file according to your formatting preferences. ⓘ You can see all the configuration options here: Artistic Style
Save the formatter.conf file to the folder where the preferences.txt file is located.
(e.g., C:\Users\<username>\AppData\Local\Arduino15\formatter.conf)
When you start Arduino IDE again you should find the auto format behaves according to your custom configuration.