我希望在 ST3 中始终使用空格而不是制表符进行缩进。
我把这些放在我的设置中:
"translate_tabs_to_spaces": true,
"convert_tabspaces_on_save": true, // for a plugin
"detect_indentation": false,
"tab_size": 4
设置 convert_tabspaces_on_save
用于强制转换 tabs-> 使用插件 ExpandTabsOnSave 保存文件时至少留出空格
但无论如何,ST3 都会使用制表符而不是空格来缩进新打开的文件。
可能是错误还是我使用了错误的设置?
提示:每当我间接修改文件 Preferences.sublime-settings
,例如使用命令 Package Control: Disable Package
它用制表符而不是空格保存
最佳答案
根据文档,这些设置应该可以解决问题(它们确实对我有用):
{
// Integer. The number of spaces a tab is considered equal to
"tab_size": 4,
// Boolean, if true, spaces will be inserted up to the next tab stop when tab is pressed, rather than inserting a tab character
"translate_tabs_to_spaces": true,
// Boolean, if true (the default), tab_size and translate_tabs_to_spaces will be calculated automatically when loading a file
"detect_indentation": true,
// Boolean, If translate_tabs_to_spaces is true, use_tab_stops will make tab and backspace insert/delete up to the next tab stop
"use_tab_stops": true
}
如果这不起作用,请尝试禁用所有插件,重新启动并查看问题是否仍然存在。如果不是,它是插件之一(或几个冲突的插件)。您可以一次启用一项并寻找问题再次出现来找出答案。
https://stackoverflow.com/questions/28189465/