Eclipse中按Tab键为8个空格

Window-->Preferences-->Java-->Code Style-->Formatter
需要自己新建个Formatter,否则提示无法编辑,此为默认设置;然后选择右边Edit按钮,在Indentation-->General Settings页中Tab policy右边的下拉框,选择Space only!
然后下面的Indentation size和Tab size都设置成你要的空格数即可!一般是8个空格!!

注意:3.6之前版本好像设置Window-->Preferences-->General-->Editors-->Text Editors右边的选项Insert spaces for tabs勾上!然后Displayed tab width=8也可以!但3.6不行!

原文地址:https://www.cnblogs.com/linjiqin/p/2946406.html