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:
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?
I would like to second this request.
I have been wishing this for a long time and would have thought that this would be thought of earlier on.
It is the reason I mostly used the external editor, gEdit on both linux and OSX, so my code can stay neat and more readable.
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.
It is done like this so copying code to the forum (or GitHub) formats correctly. It used to bother me, but now I do not really care.
- 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:
- Save and close the
- 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
<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:
- Save the
formatter.conf file to the folder where the
preferences.txt file is located.
When you start Arduino IDE again you should find the auto format behaves according to your custom configuration.