问题描述
使用崇高的文字。类似于添加新括号 { 并按 Enter 键,它会创建一个新的缩进块,如下所示(.... 是空格):
{
....
}
当我使用反引号时,我希望发生同样的事情(因为我使用的是 stlyed-components)。
所以当我输入 `+enter 时,我会得到:
`
....
`
我该怎么做?
解决方法
您需要一个带有特定条件的用于 Enter 的新键绑定。打开 Preferences → Key Bindings
并将以下内容添加到右侧:
{ "keys": ["enter"],"command": "run_macro_file","args": {"file": "res://Packages/Default/Add Line in Braces.sublime-macro"},"context":
[
{ "key": "setting.auto_indent","operator": "equal","operand": true },{ "key": "selection_empty","operand": true,"match_all": true },{ "key": "preceding_text","operator": "regex_contains","operand": "`$",{ "key": "following_text","operand": "^`","match_all": true }
]
},
这仅在您启用 "auto_indent"
设置、选择为空且光标前后的字符为反引号时才会运行。