欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

change Eclipse to use spaces instead of tabs?

程序员文章站 2022-05-01 20:21:13
Java Editor Click Window » Preferences Expand Java » Code Style Click Formatter Click the Edit button Click the Indentation tab Under General Settings ......

java editor

  1. click window » preferences
  2. expand java » code style
  3. click formatter
  4. click the edit button
  5. click the indentation tab
  6. under general settings, set tab policy to: spaces only
  7. click ok ad nauseam to apply the changes.

[note: if necessary save profile with a new name as the default profile cannot be overwritten.]

default text editor

before version 3.6:

window->preferences->editors->text editors->insert spaces for tabs

version 3.6 and later:

  1. click window » preferences
  2. expand general » editors
  3. click text editors
  4. check insert spaces for tabs
  5. click ok ad nauseam to apply the changes.

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.

c / c++

  1. click window » preferences
  2. expand c/c++ » code style
  3. click formatter
  4. click the new button to create a new profile, then ok to continue
  5. click the indentation tab
  6. under general settings, set tab policy to: spaces only
  7. click ok ad nauseam to apply the changes.

html

  1. click window » preferences
  2. expand web » html files
  3. click editor
  4. under formatting, select the indent using spaces radio button
  5. click ok to apply the changes.

css

follow the same instructions for html, but select css files instead of html files.

jsp

by default, jsp files follow the formatting preferences for html files.

xml

xml files spacing is configured in preferences.

  1. click window » preferences
  2. expand xml » xml files
  3. click editor
  4. select indent using spaces
  5. you can specify the indentation size if needed: number of spaces to inde