替换VS Code中自定义快捷方式的"< - "按键组合。

问题描述 投票:1回答:1

我想知道如何设置一个快捷方式,如 CRTL+F 的按键 <- 以获得更好的R语言编程体验。甚至当我输入 - 它在我的编码脚本上打印出完整的 <-.

我可以在RStudio中设置,但在VS Code中找不到办法。VS代码中的快捷键选项总是和IDE命令挂钩,根本帮不了我。

有什么办法吗?

visual-studio-code shortcut
1个回答
1
投票

或者使用这个方便的键盘快捷键示例,并使用doc页面中的参数。

  {
    "key": "ctrl+f",
    "command": "type",
    "args": { "text": "<-" },
    "when": "editorTextFocus && editorLangId == r"
  },


1
投票

你也可以定义一个用户片段。例如,在你的 snippets\r.json 文件。

"assign": {
    "prefix": "=",
    "body": " <- ",
    "description": "left arrow assignment"
}

现在,输入 =标签 将插入 <-.


0
投票

只需将以下代码添加到 keybinding.json 文件。

// Place your key bindings in this file to override the defaults
[
  {
    "key": "oem_minus oem_minus",
    "command": "type",
    "args": {
      "text": "<-"
    },
    "when": "editorTextFocus"
  }
]

完美的工作。当我输入 -- 它打印出来 <-.

© www.soinside.com 2019 - 2024. All rights reserved.