Sublime Text 3:制表符的 4 个空格不适用于 javascript 文件
Sublime Text 3: 4 spaces for tab not working only for javascript files
在 Sublime Text 3 中,我在用户首选项中有 4 个制表符空间。这是设置文件的一部分:
{
...
// The number of spaces a tab is considered equal to
"tab_size": 4,
// Set to true to insert spaces when tab is pressed
"translate_tabs_to_spaces": false,
// If translate_tabs_to_spaces is true, use_tab_stops will make tab and
// backspace insert/delete up to the next tabstop
"use_tab_stops": true,
// Set to false to disable detection of tabs vs. spaces on load
"detect_indentation": true,
// Calculates indentation automatically when pressing enter
"auto_indent": true,
// Makes auto indent a little smarter, e.g., by indenting the next line
// after an if statement in C. Requires auto_indent to be enabled.
"smart_indent": true,
// Adds whitespace up to the first open bracket when indenting. Requires
// auto_indent to be enabled.
"indent_to_bracket": false,
// Trims white space added by auto_indent when moving the caret off the
// line.
"trim_automatic_white_space": true,
...
}
除了 Javascript 个文件,制表符空格为 2 个,它工作正常。我不明白为什么。
有什么帮助吗?
我尝试创建 Javascript 个特定的设置文件,但它也没有用。
我遇到了同样的问题。如果您打开一个现有文件,该文件的制表符设置为 2 个空格(从 GitHub 加载的文件大多有这个)。另一方面,如果您创建一个新的 .js 文件,选项卡将按照说明设置为 4。
如@OdatNurd 所述,您已将“detect_indentation”设置为 True。这会检测加载文件的缩进。
在 Sublime Text 3 中,我在用户首选项中有 4 个制表符空间。这是设置文件的一部分:
{
...
// The number of spaces a tab is considered equal to
"tab_size": 4,
// Set to true to insert spaces when tab is pressed
"translate_tabs_to_spaces": false,
// If translate_tabs_to_spaces is true, use_tab_stops will make tab and
// backspace insert/delete up to the next tabstop
"use_tab_stops": true,
// Set to false to disable detection of tabs vs. spaces on load
"detect_indentation": true,
// Calculates indentation automatically when pressing enter
"auto_indent": true,
// Makes auto indent a little smarter, e.g., by indenting the next line
// after an if statement in C. Requires auto_indent to be enabled.
"smart_indent": true,
// Adds whitespace up to the first open bracket when indenting. Requires
// auto_indent to be enabled.
"indent_to_bracket": false,
// Trims white space added by auto_indent when moving the caret off the
// line.
"trim_automatic_white_space": true,
...
}
除了 Javascript 个文件,制表符空格为 2 个,它工作正常。我不明白为什么。
有什么帮助吗?
我尝试创建 Javascript 个特定的设置文件,但它也没有用。
我遇到了同样的问题。如果您打开一个现有文件,该文件的制表符设置为 2 个空格(从 GitHub 加载的文件大多有这个)。另一方面,如果您创建一个新的 .js 文件,选项卡将按照说明设置为 4。
如@OdatNurd 所述,您已将“detect_indentation”设置为 True。这会检测加载文件的缩进。