I tried to change the width of indentation of my Eclipse IDE to 2 via Preferences -> General -> Editors -> Text Editors -> Displayed Tab Width.

However, when I press tab or shift + tab, I still indent or un-indent by 4 spaces. Why? This still occurs even after restarting Eclipse.


If you search in preferences for the code formatter, I think you will find what you're looking for. It should be located under: Java > Code Style > Formatter

There should be a tab labeled Indentation with the settings which you seek to tweak.

enter image description here

Also, see here for how to set up the formatter to auto-format your code with Ctrl+Shift+F.

| improve this answer | |
  • I've set up the formatter to do 4 spaces as you've shown here and in the link at the bottom. When I run teh auto formatter, it still changes everything to use 2 spaces instead of 4. – Stealth Rabbi Dec 7 '15 at 15:16
  • Happy new year @StealthRabbi! Are you trying to get 4 spaces or a single tab (with the size of 4 spaces like what is shown)? If it's not taking, you can try renaming the profile and then re-applying the formatting. – rishimaharaj Jan 5 '16 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.