码迷,mamicode.com
首页 > 系统相关 > 详细

"Insert spaces for tabs" does not work in Eclipse

时间:2015-04-06 12:40:45      阅读:170      评论:0      收藏:0      [点我收藏+]

标签:

Keywords: text editor, eclipse, indention, tabs, spaces, whitespaces, white spaces, convert

"I have enabled the "Insert spaces for tabs" but there are still tabs fore tabs in editor that I am writing code. Why?"

Actually, there are other settings beside the setting for Text Editor. See below.

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 nauseum to apply the changes.

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 nauseum 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 nauseum 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 indent.

 

Reference: http://stackoverflow.com/questions/407929/how-do-i-change-eclipse-to-use-spaces-instead-of-tabs

"Insert spaces for tabs" does not work in Eclipse

标签:

原文地址:http://www.cnblogs.com/weihongji/p/4395673.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!