我正在尝试制作 key Ctrl+UpArrow
执行两个命令cursorUp
和scrollLineUp
.
我希望这会起作用,但它没有:
{
"key": "ctrl+up",
"command": ["cursorUp", "scrollLineUp"], // This doesn't work
"when": "editorTextFocus"
}
我如何在 VSCode 中做到这一点?
最佳答案
目前这是不可能的,但会跟踪相应的功能请求 here .但是你应该看看macros extension .它使您能够将不同的命令链接到单个自定义命令。然后可以将此自定义命令绑定(bind)到热键。
在您的情况下,您可以将其添加到您的 settings.json
:
"macros": {
"myCustomCommand": [
"cursorUp",
"scrollLineUp"
]
}
然后将您的自定义热键添加到
keybindings.json
:{
"key": "ctrl+up",
"command": "macros.myCustomCommand"
}
关于visual-studio-code - VSCode中如何将一个键绑定(bind)到多个命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49177014/