有没有办法在键绑定文件中设置新的规则,当我输入光标后面的字符时,它将被覆盖。
为了澄清我想要的:
if (ABC === XYZ) { // when I place cursor right after "XYZ" and type ")" mark, it will not be inserted and cursor jump right after the ")" which is already there
echo "equals"; // when I place cursor right ater "equals" and type ";" mark, it will not be inserted and cursor jump right after the semicolon which is already there. When I type it again then, it will be inserted as usual
}发布于 2021-10-22 18:49:14
是的,这是可能的-当您按下要跳过的键时,检查插入符号右边的字符是否与您按下的键相同,如果是,则移动到该键上。这是分号和闭合paren的具体绑定:(不幸的是,它包含一些重复,因为上下文不能在不编写一些插件代码的情况下接受基于哪个键被按下的参数)
{ "keys": [";"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
[
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^;", "match_all": true },
]
},
{ "keys": [")"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
[
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true },
]
},https://stackoverflow.com/questions/69670030
复制相似问题