![](/img/trans.png)
[英]How do I 'magrittr' pipe to the summarize() function of the R package 'Hmisc'?
[英]How do I had an alias for magrittr pipe from R in vscode
我想要在 vscode 中鍵入%>%
的別名(R 中的 pipe 命令)。 在 Rstudio 中,這被映射到 ctrl + shift + M,但如果由於任何原因這在 vscode 中不可用,我很高興將 map 轉換為其他內容,我只是不確定如何添加新別名。
您只需將其添加到您的keybindings.json
文件(請參閱此處了解如何打開它):
{
"key": "Ctrl+Shift+m",
"command": "type",
"args": { "text": " %>% " },
"when": "editorTextFocus"
}
這樣你就不需要宏
修改后keybindings.json
文件:
// Place your key bindings in this file to override the defaults
[
{
"key": "Ctrl+Shift+m",
"command": "type",
"args": { "text": " %>% " },
"when": "editorTextFocus"
}
]
我不使用 vscode,但也許宏可以使用https://marketplace.visualstudio.com/items?itemName=geddski.macros 工作。 它在將Arguments 傳遞給命令部分中說:
許多命令都接受 arguments,例如“type”命令,它可以讓您將文本插入編輯器。
也許這會起作用(未經測試)。 將此添加到您的settings.json
:
"macros": {
"addPipe": [
"cursorEnd",
{"command": "type", "args": {"text": "%>%"}}
]
}
這對你的keybindings.json
:
{
"key": "ctrl+shift+M",
"command": "macros.addPipe"
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.