Jon*_*nas 121 indentation intellij-idea
如何在IntelliJ IDEA 11.0中使用制表符而不是多个空格进行缩进?
我在"代码样式">"常规">"默认缩进选项"下选中了 "使用制表符".并且还尝试检查"智能标签",但它没有帮助.
从文档:
如果选中此复选框,则使用制表符:
- 按Tab键
- 缩进
- 用于代码重新格式化
否则,使用空格而不是制表符.
Paw*_*rok 206
文件 > 设置 > 编辑器 > 代码样式 > Java > 选项卡和缩进 > 使用制表符
根据需要替换Java的首选武器.
ROM*_*eer 42
您有以下选择:
Ctrl+ Shift+ A>写"标签">双击"标签"
如果要将制表符转换为空格,可以编写"空格",然后选择"To Spaces".
编辑>转换缩进>到选项卡
要将标签转换为空格,您可以从同一位置选择"To Spaces".
其他答案中的路径稍有改变:

如果您选中/取消选中" 设置..."或" 其他设置">"默认设置..."框,则无关紧要,因为从一个窗口进行的更改将在另一个窗口中可用.
上述更改将应用于新文件,但如果要将空格更改为现有文件中的选项卡,则应按+ + 格式化文件.CtrlAltL
Ben*_*Ben 24
我已经开始使用IntelliJ IDEA Community Edition 版本12.1.3,我在以下位置找到了该设置: -
File > Other Settings > Default Settings > {choose from Code Style dropdown}
Run Code Online (Sandbox Code Playgroud)
vis*_*shd 14
对于任何无法获得此功能的人,您还需要取消选中以下内容
Preferences > Editor > Code Style
[] Enable EditorConfig support
EditorConfig may override the IDE code style settings
Run Code Online (Sandbox Code Playgroud)
我的IntelliJ版本15.0.4
Dmi*_*zin 10
IDEA中另一个有用的选项,如果您确实需要,可以关闭或保持检查:
Preferences -> Code Style -> Detect and use existing file indents for editing
Run Code Online (Sandbox Code Playgroud)
如果您的团队要使用空格编写的现有代码切换到制表符格式,请取消选中
小智 6
你试过.editorconfig吗?您可以在项目的根目录中创建此文件,并为不同的文件类型配置缩进.您的代码将自动格式化.这是一个例子:
# top-most EditorConfig file
root = true
# matches all files
[*]
indent_style = tab
indent_size = 4
# only json
[*.json]
indent_style = space
indent_size = 2
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
88866 次 |
| 最近记录: |