作者:じ☆ve宝贝
发布时间:2015-11-23T14:55:35
1、下载eclipse-java-google-style.xml
https://github.com/google/styleguide
2、 导入方法:
Eclipse->window->preferences->
Java->Code Style->Formatter->Import
选择eclipse-java-google-style.xml文件
点击apply,ok就行了。 3、这样就可以选中代码进行格式化(默认快捷键是Ctrl+Shift+F),用以保持代码风格一致。
//默认的缩进是2格,一般习惯都是四格的缩进,可以在edit里面修改一下
indentation size 4;Tab size 4;
1.Java代码
Preferences->Java->Code Style->Formatter->Edit ->Line Wrapping->Maximum line
width:默认80加个0,改成800就行了。
2.CSS代码
Window->Preferences->Web->CSS Files->Editor->Line
width:默认为72加个0,改为720保存。
3.Html代码
Window->Preferences->Web->HTML Files->Editor->Line
width:默认为72加个0,改为720保存。
4.JSP代码
Window->Preferences->Web->JSP Files->Editor->Line
width:默认为72加个0,改为720保存。