基于每个文件的 Sublime 缩进

Sublime indentation on per file basis

使用 Sublime Text 3。打开文件时,有些文件缩进了 2 个空格(而大多数文件缩进了 4 个空格)。

有什么方法可以在每个文件的基础上设置缩进吗?

在菜单 select View » Indentation » Tab Width: 2 中,仅将打开的文件的缩进设置为 2 个空格。下次您重新打开此文件时,Sublime Text 会根据在特定文件中找到的缩进来猜测缩进是 2 还是 4 个空格。

Note: This can technically only work with spaces as indentation. If tabs are used as indentation there is no way to set the tab width on a per file basis, but on a per file type basis.