我一直在有效地使用Sublime文本。我有一个困扰我的问题。
当我键入JavaScript代码时,如果将Tab键另外按到提供的缩进级别,则Tab键不会转换为空格。
以下屏幕截图可以帮助您了解我的问题:
如您所见,缩进的初始级别正确设置为8个空格。如果我再按一次制表符,则会插入一个实际的制表符,而不是我想要的4个空格。
以下是我的User Preferences.sublime-settings配置文件:
{
"color_scheme": "Packages/User/Cobalt (SL).tmTheme",
"detect_indentation": false,
"expand_tabs_on_save": true,
"font_size": 10,
"ignored_packages":
[
"Vintage"
],
"tab_size": 4,
"translate_tabs_to_spaces": true,
"trim_automatic_white_space": true,
"use_tab_stops": 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,
}
该配置似乎已正确设置。是否知道为什么会发生以及如何解决?
最佳答案
有时smart_indent可能使事情变得困惑。尝试将以下行添加到“首选项”>“设置用户”"smart_indent": false
关于tabs - Sublime Text不会在缩进时将制表符转换为空格...为什么以及如何解决它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22579424/