评论后如何强制ST3使用空格进行缩进?例如,现在就是这样:
(tab)/**
(tab) * some text (tab)another text
(tab) */
但它应该是
(tab)/**
(tab) * some text (space,space,space,space)another text
(tab) */
很抱歉,如果这个问题不是关于“编程”本身,但它非常烦人,我用Google搜索了大约一个小时,但找不到任何东西。
编辑:我使用tab缩进作为默认值并希望保持这种方式。我想改变的只是一条线开始后的缩进。答案 0 :(得分:1)
转到Preferences -> Key Bindings - User
并添加以下内容:
{ "keys": ["tab"], "command": "insert", "args": {"characters": " "}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "comment" }
]
}
如果此文件尚未包含任何内容,请务必将所有内容括在方括号[]
中:
[
{ "keys": ["tab"], "command": "insert", "args": {"characters": " "}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "comment" }
]
}
]
每当在注释中按 Tab 时,这将插入4个空格,否则它将保持其正常行为。
答案 1 :(得分:0)
将其添加到您的设置文件中:
"translate_tabs_to_spaces": true
修改强>
我一开始没看到你的编辑。我不认为有一种方法可以配置sublime,以便你在行的开头tabs
然后spaces
,我很抱歉,但我认为你必须手动执行,或者编写自己的插件。
或者你可以使用上面提到的设置,然后禁用它并使用多行选择并手动删除行开头的空格,然后添加标签。
对于多行使用:
ctr+alt+<arrow up/down>