"Insert spaces for tabs" does not work in Eclipse
2015-04-06 11:46
316 查看
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.
Expand Java » Code Style
Click Formatter
Click the Edit button
Click the Indentation tab
Under General Settings, set Tab policy to:
Click OK ad nauseum to apply the changes.
Version 3.6 and later:
Click Window » Preferences
Expand General » Editors
Click Text Editors
Check Insert spaces for tabs
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.
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:
Click OK ad nauseum to apply the changes.
Expand Web » HTML Files
Click Editor
Under Formatting, select the Indent using spaces radio button
Click OK to apply the changes.
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.
Reference: http://stackoverflow.com/questions/407929/how-do-i-change-eclipse-to-use-spaces-instead-of-tabs
"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
Click Window » PreferencesExpand 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 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:
Click Window » Preferences
Expand General » Editors
Click Text Editors
Check Insert spaces for tabs
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++
Click Window » PreferencesExpand 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 nauseum to apply the changes.
HTML
Click Window » PreferencesExpand Web » HTML Files
Click Editor
Under Formatting, select the Indent using spaces radio button
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.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.
Reference: http://stackoverflow.com/questions/407929/how-do-i-change-eclipse-to-use-spaces-instead-of-tabs
相关文章推荐
- python : matplotlib does not work in Eclipse
- error MSB4057: The target "PlatformPrepareForBuild" does not exist in the project
- jbpm5.4手动配置——尤其解决“ant install.jBPM-eclipse.into.eclipse”does not exist in the project "lBPM.install"
- SQL Server error "Xml data type is not supported in distributed queries" and workaround for it
- parameter "timeout" in socketchannel does not work
- httpModules remove does not work in a folder or virtual directory
- Repeated column in mapping for entity:(should be mapped with insert="false" update="false")
- vs2005 "Key not valid for use in specified state"
- Visual Studio 2010 发布Web项目提示The target "PipelinePreDeployCopyAllFilesToOneFolder" does not exist in the project.解决方法
- 关于java三元运算符,(i%5==0)?System.out.println():System.out.print(" "); does not work!
- Application "org.eclipse.ui.ide.workbench" could not be found in the registry.问题的解决
- Oracle中"listener does not currently know of SID given in connect descriptor"
- Why "Do not call CWnd::OnPaint() for painting messages" in a derived CWnd?
- 关于C#中的错误:The type 'X' does not exists in the "Y"
- Solution for "Could not initialize class org.eclipse.jface.preference.PreferenceConverter"
- 关于The target "GetCopyToOutputDirectoryContentProjectItems" does not exist in the project.的解决方法
- Oracle中"listener does not currently know of SID given in connect descriptor"
- Repeated column in mapping for entity: .... should be mapped with insert="false" update="false"
- Oracle中"listener does not currently know of SID given in connect descriptor"
- Does not support program for platform "WINSCW"