1. windows=》preferences=》general=》editors=》text editors =》勾选 “insert spaces for tabs”
2. Java:windows=》preferences=》Java =》 Code Style =》 Formatter =》点击右边的Active profile 的Edit =》Indentation =》Tab Policy 选为 Spaces Only,然后下面的Indentation size 和 Tab size 都设置成你要的空格数即可!一般是4个空格!!
3. JavaScript :windows=》preferences=》JavaScript =》 之后的步骤与Java一样
4. C/C++ :windows=》preferences=》C/C++ =》 之后的步骤与Java一样
5. PHP:windows=》preferences=》PHP =》Code Style =》 Formatter =》Tab Policy 选为 Spaces ,Indentation size填4
6.Html :windows=》preferences=》Web =》HTML Files =》Editors =》选择“Indent using spaces”,Indentation size填4
7.XML :windows=》preferences=》XML =》XML Files =》之后的步骤与Html 一样
有些人可能想空格,用小圆点代替,方法: windows=》preferences=》general=》editors =》text editors=》选中“Show whitespace characters”
配置eclipse 格式化默认长度:
Window->Preferences->Java->Code Style->Formatter->Edit ->Line Wrapping->Maximum line width:默认80