如何使用崇高键盘映射将光标发送到下一行



我正在使用键盘映射通过按ctrl + enter在崇高的repl中执行当前行。光标保持在同一行上。我需要向键盘映射添加什么,以便光标跳到下一行(就像在 RStudio 中发生的那样)?

[
    { "keys": ["ctrl+enter"], "command": "repl_transfer_current", "args": {"scope": "lines"}}
]

我找到了一种使用 python 脚本插件的方法。显然,默认情况下,Sublime没有在单个键盘映射下运行多个命令的选项。我使用了这里的方法:https://forum.sublimetext.com/t/run-multiple-commands-command/6848

步骤如下:

  1. 崇高 - 工具 - 开发者 - 新插件

从此处找到的run_multiple_commands.py复制代码:https://gist.github.com/bgmort/7ae52ea4270f1c404321c20d1b97733c#file-run_multiple_commands-py并以与 GitHub 上相同的名称保存文件:run_multiple_commands.py

  1. 崇高 - 首选项 - 键绑定用户

法典:

{
  "keys": ["ctrl+enter"],
  "command": "run_multiple_commands",
  "args": {
    "commands": [
      { "command": "repl_transfer_current", "args": {"scope": "lines"} },
      { "command": "move", "args": {"by": "lines", "forward": true} }
    ]
  }
}

或者,如果文件为空,则另外添加 [ ]:

[{
  "keys": ["ctrl+enter"],
  "command": "run_multiple_commands",
  "args": {
    "commands": [
      { "command": "repl_transfer_current", "args": {"scope": "lines"} },
      { "command": "move", "args": {"by": "lines", "forward": true} }
    ]
  }
}] 

最新更新