如何更改Eclipse以使用空格而不是选项卡? [英] How do I change Eclipse to use spaces instead of tabs?

查看:376
本文介绍了如何更改Eclipse以使用空格而不是选项卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下, Eclipse 具有硬标签字符。如何将其更改为空格?

By default Eclipse indents with a hard tab character. How do I change it to spaces?

推荐答案

Java编辑器



Java Editor


  1. 点击窗口»偏好设置

  2. 展开 Java »代码样式

  3. 点击格式化器

  4. 点击编辑按钮

  5. 点击缩进标签

  6. 常规设置下,设置 Tab策略到:仅限空间

  7. 点击确定广告恶意应用更改。

  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.]

版本3.6之前:

Window->Preferences->Editors->Text Editors->Insert spaces for tabs

版本3.6及更高版本:

Version 3.6 and later:


  1. 点击窗口»偏好设置

  2. 展开常规»编辑器

  3. 点击文本编辑器

  4. 检查为标签插入空格

  5. 点击确定广告,以应用更改。

  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.

请注意,默认文本编辑器用作Eclipse中许多非Java编辑器的基础。令人惊讶的是,这个设置在3.3之前是不可用的。

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.


  1. 点击窗口»偏好设置

  2. 展开 C / C ++ » strong>

  3. 点击格式化器

  4. 点击新建按钮创建一个新的配置文件,然后确定继续

  5. 点击缩进标签

  6. 常规设置,将标签政策设置为:仅限空间

  7. 点击确定 ad nauseam to apply the changes。

  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



HTML


  1. 单击窗口»首选项

  2. 展开 Web » HTML文件

  3. 点击编辑器

  4. 格式化下,选择使用空格单选按钮

  5. 点击确定应用更改。

  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



按照与HTML相同的说明,但选择 CSS文件而不是 HTML文件

默认情况下,JSP文件遵循HTML文件的格式设置首选项。

By default, JSP files follow the formatting preferences for HTML Files.

在首选项中配置XML文件间距。

XML files spacing is configured in Preferences.


  1. 单击窗口»首选项

  2. 展开 XML » XML文件

  3. 点击编辑器

  4. 选择使用空格缩进

  5. 如果需要,您可以指定缩进大小:要缩进的空格数。

  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.

这篇关于如何更改Eclipse以使用空格而不是选项卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆