How can I configure NetBeans to insert tabs instead of a bunch of spaces?

openfrog picture openfrog · Dec 22, 2009 · Viewed 72.1k times · Source

When I hit Tab for indenting code, I like to get a real tab. Meaning that when I select that, I only have one large thing selected. NetBeans inserts 5 spaces instead of a tab when I hit Tab. Is there a way I can change that?

Answer

Álvaro González picture Álvaro González · Dec 22, 2009

Go to Tools-> Options-> Editor-> Formatting and uncheck Expand tabs to spaces:

Expand Tabs to Spaces

Ensure you also pick coherent values for "Number of Spaces per indent" and "Tab Size".


Additionally, you can check all the items in the Language combo and make sure they all use the general setting.

Use All Languages Setting

You can also change it in a per-project fashion. Right click on the project icon, select Properties and review the Formatting category.

Use project specific options

These menu items remain valid as of NetBeans 8.0.