[英]Multiple actions on one keyboard shortcut in vscode
是否可以將多個操作分配給 Visual Studio 代碼中的一個鍵盤快捷鍵?
例如:將 cursor 向上移動 x 3 設置為“ctrl + w”
提前致謝。
可以使用像Commands這樣的擴展
settings.json
"commands.commands": {
"down3": {
"sequence": [
"cursorDown",
"cursorDown",
"cursorDown",
],
},
},
keybindings.json
{
"key": "ctrl+w",
"command": "down3",
},
或者只使用keybindings.json
{
"key": "ctrl+w",
"command": "commands.run",
"args": [
"cursorDown",
"cursorDown",
"cursorDown"
]
},
雖然,對於這個特定的例子,最好使用built-in
命令(以避免任何跳躍):
{
"key": "ctrl+w",
"command": "cursorMove",
"args": {
"to": "down",
"by": "line",
"value": 3
}
}
對於正在尋找答案的其他人,請學習制作自己的 VS 代碼擴展。 大約花了一個小時,我能夠制作執行多個命令的各種快捷方式。 vs 代碼站點有很好的資源: https : //code.visualstudio.com/docs/extensions/overview
我使用宏擴展( https://marketplace.visualstudio.com/items?itemName=geddski.macros ):
在 settings.json 中:
"macros": {
"showGit": ["workbench.view.scm", "git-graph.view"]
}
然后在 keybindings.json 中:
{
"key": "ctrl+shift+g",
"command": "showGit"
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.