visual-studio-code - VSCode中如何将一个键绑定(bind)到多个命令

标签 visual-studio-code command key-bindings

我正在尝试制作 key Ctrl+UpArrow执行两个命令cursorUpscrollLineUp .

我希望这会起作用,但它没有:

{
  "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/

相关文章:

java - Thales HSM 8000 A2 命令发送(生成清除组件)

html - HTML 文件中的 Visual Studio 代码注释

c++ - 启动 Weston 时无法开始调试

c# - ListView 上下文菜单上的命令绑定(bind)未触发(未找到)?

bash - zsh:找不到命令:ng

具有多个击键的 Emacs 键绑定(bind)

java - 使用操作更新另一个类中的实例变量

angularjs - Visual Studio Code Chrome 调试器扩展 - [webkit-debug-adapter] 得到了目标应用程序的响应,但未找到有效的目标页面

visual-studio-code - 在 vscode 扩展配置上屏蔽用户输入(例如密码)

python - Docker hyperkit 进程 CPU 使用率变得疯狂。如何控制它?