簡體   English   中英

替換 VS Code 中自定義快捷方式的“< -”擊鍵組合

[英]Replace "< -" keystroke combination for a custom shortcut in VS Code

我想知道如何設置快捷方式,例如用於擊鍵的CRTL+F <-以獲得更好的 R 語言編程體驗。 甚至當我輸入-它會在我的編碼腳本上打印出完整的<-

我可以在 RStudio 中設置它,但找不到在 VS 代碼中執行此操作的方法。 VS Code 中的快捷方式選項總是鏈接到 IDE 命令,對我沒有任何幫助。

有任何想法嗎?

或者將這個方便的鍵盤快捷方式示例與文檔頁面中的 arguments 結合使用

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

您還可以定義用戶片段。 例如,將其放入您的snippets\r.json文件中:

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

現在,鍵入= Tab將插入<-

只需將以下代碼添加到keybinding.json文件即可:

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

工作完美。 當我輸入--它打印出<-

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM