首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Sublime text 4中键入相同字符时覆盖下一个字符

在Sublime text 4中键入相同字符时覆盖下一个字符
EN

Stack Overflow用户
提问于 2021-10-22 00:02:51
回答 1查看 25关注 0票数 0

有没有办法在键绑定文件中设置新的规则,当我输入光标后面的字符时,它将被覆盖。

为了澄清我想要的:

代码语言:javascript
复制
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
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-10-22 18:49:14

是的,这是可能的-当您按下要跳过的键时,检查插入符号右边的字符是否与您按下的键相同,如果是,则移动到该键上。这是分号和闭合paren的具体绑定:(不幸的是,它包含一些重复,因为上下文不能在不编写一些插件代码的情况下接受基于哪个键被按下的参数)

代码语言:javascript
复制
    { "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 },
      ]
    },
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69670030

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档