参考:java编程规范之eclipse设置tab键为四个空格

 

Eclipse版本

 

1、点击菜单Window > Preference

 

2、在Preferences窗口中,展开General > Editors,选Text Editors,勾选Insert spaces for tabs,点击Apply

 

3、在Preferences窗口中,展开Java > Code Style,选Formatter,点击New…;在New Profile窗口中,填写Profile name之后,点击OK

 

4、在弹出的Profile \’…\’窗口中,展开Indentation,设置Tab policy: Spaces only,点击OK

 

5、在Preferences窗口中,点击Apply and Close。

以后,每当我们在代码编辑器中按下Tab键,就会插入4个空格。

 

6、如果想显示空格,可以在Preferences窗口中,展开General > Editors,选Text Editors,勾选Show whitespace characters (configure visibility)

版权声明:本文为Satu原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/Satu/p/10871477.html