I'm using the last version of NetBeans and I would like to know if there is a feature (or a plugin) that converts the tabs into spaces on existing files without changing anything else.
Asked
Active
Viewed 1,559 times
2 Answers
3
If you have automatic tab expansion enabled [0], then performing a Source
-> Format
will convert all tabs to spaces. Keep in mind that will also apply any other options found in that dialog, such as adding/removing blank lines or spaces and changing the position of curly brackets.
[0] it is by default, in Options
-> Editor
-> Formatting
, check the Expand Tabs To Spaces
box

Fanis Hatzidakis
- 5,282
- 1
- 33
- 36
-
1Thanks for your answer but unfortunately I'm searching for a way to ONLY convert the tabs to spaces without touching anything else. – user2572526 Aug 25 '17 at 13:08
-
In addition to that, it seems to only convert tabs at the beginning of a line. When the tab is somewhere in the middle of a line, it won't be converted. – Moni Sep 06 '18 at 07:03
2
It's a hack, but you can use search and replace.
- Ctrl-H, Open the search/replace dialog
- Toggle the small cog button to enable search by regex (It's just to the right of the 'Match case' and 'Whole word' toggles)
- Enter \t in the 'Find What' input
- Using the space bar, enter four spaces in the 'Replace With' input
- Test using the Next button at least a few times :-)

GTM
- 61
- 1
- 10