最近,我遇到了一篇文章,其中包含一个出色的脚本,用于继续在 CSS 的崇高文本中进行块评论,Here。并将其添加到特定于环境的键绑定文件就像一个魅力。但是,当我尝试将其更改为与乳胶注释一起使用时(即,将 * 替换为 %)它不起作用。
原始代码:
{"keys": ["enter"], "command": "insert", "args" : {"characters": "\n * "},
"context":
[
{"key": "selection_empty", "operator": "equal", "operand": true},
{"key": "preceding_text", "operator": "regex_contains",
"operand": "\\/\\*\\*$", "match_all": true}
]
},
{"keys": ["enter"], "command": "insert", "args" : {"characters": "\n* "},
"context":
[
//{"key": "selection_empty", "operator": "equal", "operand": true},
{"key": "preceding_text", "operator": "regex_contains",
"operand": "^[\t ]*\\*[^\\/]", "match_all": true}
]
},
我的代码:
{"keys": ["enter"], "command": "insert", "args" : {"characters": "\n % "},
"context":
[
{"key": "selection_empty", "operator": "equal", "operand": true},
{"key": "preceding_text", "operator": "regex_contains",
"operand": "\\/\\%\\%$", "match_all": true}
]
},
{"keys": ["enter"], "command": "insert", "args" : {"characters": "\n % "},
"context":
[
//{"key": "selection_empty", "operator": "equal", "operand": true},
{"key": "preceding_text", "operator": "regex_contains",
"operand": "^[\t ]%\\%[^\\/]", "match_all": true}
]
},