如何更改Eclipse以使用空格而不是选项卡? [英] How do I change Eclipse to use spaces instead of tabs?
问题描述
默认情况下, Eclipse 具有硬标签字符。如何将其更改为空格?
By default Eclipse indents with a hard tab character. How do I change it to spaces?
推荐答案
Java编辑器
Java Editor
- 点击窗口»偏好设置
- 展开 Java »代码样式
- 点击格式化器
- 点击编辑按钮
- 点击缩进标签
- 在常规设置下,设置 Tab策略到:
仅限空间
- 点击确定广告恶意应用更改。
- Click Window » Preferences
- Expand Java » Code Style
- Click Formatter
- Click the Edit button
- Click the Indentation tab
- Under General Settings, set Tab policy to:
Spaces only
- 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:
- 点击窗口»偏好设置
- 展开常规»编辑器
- 点击文本编辑器
- 检查为标签插入空格
- 点击确定广告,以应用更改。
- Click Window » Preferences
- Expand General » Editors
- Click Text Editors
- Check Insert spaces for tabs
- 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.
- 点击窗口»偏好设置
- 展开 C / C ++ » strong>
- 点击格式化器
- 点击新建按钮创建一个新的配置文件,然后确定继续
- 点击缩进标签
- 在常规设置,将标签政策设置为:
仅限空间
- 点击确定 ad nauseam to apply the changes。
- Click Window » Preferences
- Expand C/C++ » Code Style
- Click Formatter
- Click the New button to create a new profile, then OK to continue
- Click the Indentation tab
- Under General Settings, set Tab policy to:
Spaces only
- Click OK ad nauseam to apply the changes.
HTML
HTML
- 单击窗口»首选项
- 展开 Web » HTML文件
- 点击编辑器
- 在格式化下,选择使用空格单选按钮
- 点击确定应用更改。
- Click Window » Preferences
- Expand Web » HTML Files
- Click Editor
- Under Formatting, select the Indent using spaces radio button
- 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.
- 单击窗口»首选项
- 展开 XML » XML文件
- 点击编辑器
- 选择使用空格缩进
- 如果需要,您可以指定缩进大小:要缩进的空格数。
- Click Window » Preferences
- Expand XML » XML Files
- Click Editor
- Select Indent using spaces
- You can specify the Indentation size if needed: number of spaces to indent.
这篇关于如何更改Eclipse以使用空格而不是选项卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!