Tab键的缩进
- 设置默认缩进:preferences -> setting -> setting-User 添加以下代码:
"tab_size": 4,
"translate_tabs_to_spaces": true,
"expand_tabs_on_save": true
- 对于已经创建好的项目,默认设置是不生效的,而且每次修改完文件之后,重启 sublime 并不会生效。
解决方法:安装 EditorConfig 插件,然后设置 .editorconfig文件,强制设置项目的 tab_size. 在项目的根目录下创建 .editorconfig,然后编辑,以 python 为例:
; -*- conf -*-
; EditorConfig is awesome: http://EditorConfig.org
; top-most EditorConfig file
root = true
; Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = false
charset = utf-8
indent_style = space
indent_size = 2
tab_width = 2
[*.py]
indent_style = space
indent_size = 4