使用VSCODE添加四分之一文档中R块的键盘快捷键

发布于 2025-02-11 05:27:41 字数 454 浏览 1 评论 0原文

是否可以使用VSCODE在四分之一文档中为r块添加键盘快捷键?

我正在尝试使用管道操作员%>%ctrl+shift+shift+m​​)等快捷方式。我认为我应该通过在keybinds.json文件中包含以下代码来做到这一点,但这对我不起作用:

    {
      "key": "ctrl+shift+m",
      "command": "type",
      "when": "editorLangId == 'r' || editorTextFocus && editorLangId == 'qmd'",
      "args": { "text": " %>% " }
    },

Is it possible to add keyboard shortcuts for R chunks in quarto documents using vscode?

I'm trying to use shortcuts like the pipe operator %>% (ctrl+shift+m) and others. I thought I should do this by including something like the code below in the keybinds.json file, but it doesn't work for me:

    {
      "key": "ctrl+shift+m",
      "command": "type",
      "when": "editorLangId == 'r' || editorTextFocus && editorLangId == 'qmd'",
      "args": { "text": " %>% " }
    },

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如若梦似彩虹 2025-02-18 05:27:41

我假设keybinds.json是您帖子中的错别字(正确的文件名是keybindings.json)。

只要我已经正确理解您,这是我的keybindings.json

// Place your key bindings in this file to override the defaults
[{
    "key": "ctrl+shift+m",
    "command": "type",
    "args": { "text": "%>%" },
    "when": "editorTextFocus"
  }
]

ctrl+shift+m​​,然后在光标的当前位置放置“%>%”。

I assume keybinds.json is a typo in your post (the correct filename is keybindings.json).

Provided I have understood you correctly, here is my keybindings.json

// Place your key bindings in this file to override the defaults
[{
    "key": "ctrl+shift+m",
    "command": "type",
    "args": { "text": "%>%" },
    "when": "editorTextFocus"
  }
]

Ctrl+Shift+m then places "%>%" at the current position of the cursor.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文