# IDE 2.1.0 Tab Stops?

**URL:** <https://forum.arduino.cc/t/ide-2-1-0-tab-stops/1121204>\
**Category:** IDE 2.x\
**Created:** [April 29, 2023, 3:18pm UTC](https://forum.arduino.cc/t/ide-2-1-0-tab-stops/1121204 "2023-04-29T15:18:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mottretop](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@mottretop](https://forum.arduino.cc/u/mottretop)\
**Post date:** [April 29, 2023, 3:18pm UTC](https://forum.arduino.cc/t/ide-2-1-0-tab-stops/1121204/1 "2023-04-29T15:18:00Z")

</div>

Hi,

I can't figure out where in the IDE to change the width of the tab stops. There is nothing under file-preferences for the editor that I can see? This seems crazy to me that 2 spaces, as a default, is good for anyone !?!?

Thanks!

---

<div class="post-metadata">

**Author:** ![ptillisch](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@ptillisch](https://forum.arduino.cc/u/ptillisch)\
**Post date:** [April 29, 2023, 6:50pm UTC](https://forum.arduino.cc/t/ide-2-1-0-tab-stops/1121204/2 "2023-04-29T18:50:48Z")

</div>

Hi @mottretop. There are two separate systems to configure:

- Indentation style while editing
- Indentation style of the auto formatter

I'll provide instructions you can follow to configure both these things to use your preferred number of spaces:

## Editor

The editor behavior can be configured in Arduino IDE's [advanced settings](https://github.com/arduino/arduino-ide/blob/main/docs/advanced-usage.md#advanced-settings):

1. Press the **Ctrl** + **Shift** + **P** keyboard shortcut ( **Command** + **Shift** + **P** for macOS users) to open the "Command Palette".  
A menu will appear on the editor toolbar:  
 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/d/6/d/d6d06cdc2510d164ddbdde759fe56e215a747352.png)
2. Select the "**Preferences: Open Settings (UI)**" command from the menu.  
**ⓘ** You can scroll down through the list of commands to find it or type the name in the field.  
A " **Preferences**" tab will open in the Arduino IDE main panel.
3. Type `editor.tabSize` in the " **Search Settings**" field of the " **Preferences**" tab.
4. Set the field under the " **Editor: Tab Size**" setting to your preferred number of spaces.
5. Close the **Preferences** tab by clicking its **X** icon.

## Auto Format

The sketch code can be automatically formatted to a standardized style by selecting **Tools \> Auto Format** from the Arduino IDE menus. It is possible to define a custom formatter configuration.

The configuration system is documented in general here:

[https://docs.arduino.cc/software/ide-v2/tutorials/ide-v2-customize-auto-formatter](https://docs.arduino.cc/software/ide-v2/tutorials/ide-v2-customize-auto-formatter)

The standardized formatter configuration file is available from the link in that tutorial. If you would like the formatter to use a different number of spaces, use that file, but change the value of the relevant properties.

For example, if you want an indent of 8 spaces, change this line:

```yaml
IndentWidth: 2

```

To this:

```yaml
IndentWidth: 8

```

---

<div class="post-metadata">

**Author:** ![mottretop](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@mottretop](https://forum.arduino.cc/u/mottretop)\
**Post date:** [April 29, 2023, 7:03pm UTC](https://forum.arduino.cc/t/ide-2-1-0-tab-stops/1121204/3 "2023-04-29T19:03:46Z")

</div>

Wow Thanks!

They couldn't have made that more difficult if they tried!!

---

<div class="post-metadata">

**Author:** ![ptillisch](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@ptillisch](https://forum.arduino.cc/u/ptillisch)\
**Post date:** [April 29, 2023, 7:06pm UTC](https://forum.arduino.cc/t/ide-2-1-0-tab-stops/1121204/4 "2023-04-29T19:06:25Z")

</div>

The instructions under the "Auto Format" section are only required due to a bug in Arduino IDE:

> <https://github.com/arduino/arduino-ide/issues/1133>
>
> \### Describe the problem
> 
> Sorry if I'm rude as this is the first time I've use…d this.
> 
> I would like to change the tab size from 2 to 4
> I was able to change the width when typing with the keyboard, but not when auto-formatting.
> 
> Please, and thank you
> 
> \### To reproduce
> 
> In the Command Palette (Ctrl+Shift+P), select "Preferences". Selected "Open Preferences".
> I then selected "Editor"; in the Advanced Settings GUI I selected "Tab Size" and changed it.
> 
> \### Expected behavior
> 
> When I press Control + T, the tab is formatted with two sizes
> 
> \### Arduino IDE version
> 
> 2.0.0-rc8
> 
> \### Operating system
> 
> Windows
> 
> \### Operating system version
> 
> 10
> 
> \### Additional context
> 
> \_No response\_
> 
> \### Issue checklist
> 
> \- \[X\] I searched for previous reports in \[the issue tracker\](https://github.com/arduino/arduino-ide/issues?q=)
> \- \[X\] I verified the problem still occurs when using the latest \[nightly build\](https://github.com/arduino/arduino-ide#nightly-builds)
> \- \[X\] My report contains all necessary details

Once that is fixed, the formatter will be automatically configured when you change the " **Editor: Tab Size**" setting.

If you have a [**GitHub**](https://github.com/) account, you can subscribe to that issue to get notifications of any new developments related to this subject.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [October 26, 2023, 7:07pm UTC](https://forum.arduino.cc/t/ide-2-1-0-tab-stops/1121204/5 "2023-10-26T19:07:14Z")

</div>

Closed on October 26, 2023, 7:07pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
