sublimetext3 - 如何自动添加新行并缩进崇高文本中的反引号?
问题描述
使用崇高的文本。类似于添加新括号 { 并按 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", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "`$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true }
]
},
这只会在您打开"auto_indent"
设置、选择为空并且光标前后的字符是反引号时运行。
推荐阅读
- python - 从纬度/经度点表中为python中的热图在地图上绘制自定义多边形?
- javascript - 尝试创建嵌套列表时失去编辑器焦点 (Draft.js)
- wcf - 可以接收任何请求的 svc 服务
- javascript - 为什么数据不能与 JSON 文件绑定?
- java - java.io.FileNotFoundException:在 tomcat 中提取战争或部署战争时出现许可证(是目录)异常
- swift - 无法从 FIRStorage 下载用户个人资料图片
- c# - 在 IIS 上部署 ASPNet 核心在除根以外的其他 URI 上出现 404 错误
- eclipse - 如何在 Eclipse Kepler 中安装 Flowable 设计器
- lucene - Alfresco:搜索特定元数据字段的字段
- javascript - 如何避免安装和更新 Vue 组件之间的重复