Tuesday, May 28, 2013

How to change Eclipse to use spaces instead of tabs



For the default text editor:
  • General > Editors > Text Editors > Insert spaces for tabs (check it)
For PHP:
  • PHP > Code Style > Formatter > Tab policy (choose "spaces")
  • PHP > Code Style > Formatter > Indentation size (set to 4)
For CSS:
  • Web > CSS > Editor > Indent using spaces (select it)
  • Web > CSS > Editor > Indentation size (set to 4)
For HTML:
  • Web > HTML > Editor > Indent using spaces (select it)
  • Web > HTML > Editor > Indentation size (set to 4)
For XML:
  • XML > XML Files > Editor > Indent using spaces (select it)
  • XML > XML Files > Editor > Indentation size (set to 4)
For Javascript:
  • Javascript > Preferences > Code Style > Formatter > Edit > Indentation (choose "spaces only")
  • Rename the formatter settings profile to save it
For Java:
  • Java > Preferences > Code Style > Formatter > Edit > Indentation (choose "spaces only")
  • Rename the formatter settings profile to save it

To search for all the tabs in eclipse.
Search > File > search for containing text "\t" and select Regular expression > Search

To replace tab with spaces
Search > File > search for containing text "\t" and select Regular expression > Replace > Enter 4 spaces.

No comments:

Post a Comment