By default Eclipse indents with a hard tab character. How do I change it to spaces?
Open Window->Preferences from menu bar. Select Text Editors from tree menu. Uncheck Insert spaces for tabs .
File->Switch Workspace,>… to switch to a different workspace. When Eclipse restarts in the new workspace select File->Import then General->Preferences click Next and browse to your saved preferences file and click Finish to import your preferences into the current workspace.
Spaces only
[Note: If necessary save profile with a new name as the default profile cannot be overwritten.]
Before version 3.6:
Window->Preferences->Editors->Text Editors->Insert spaces for tabs
Version 3.6 and later:
Note that the default text editor is used as the basis for many non-Java editors in Eclipse. It's astonishing that this setting wasn't available until 3.3.
Spaces only
Follow the same instructions for HTML, but select CSS Files instead of HTML Files.
By default, JSP files follow the formatting preferences for HTML Files.
XML files spacing is configured in Preferences.
For the default text editor:
Insert spaces for tabs
(check it) For PHP:
Tab policy
(choose "spaces") Indentation size
(set to 4) For CSS:
Indent using spaces
(select it) Indentation size
(set to 4) For HTML:
Indent using spaces
(select it) Indentation size
(set to 4) For XML:
Indent using spaces
(select it) Indentation size
(set to 4) For Javascript:
Indentation
(choose "spaces only") For Java:
Indentation
(choose "spaces only") If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With