gpt4 book ai didi

keyboard-shortcuts - 在组合键上配置多个命令

转载 作者:行者123 更新时间:2023-12-02 03:11:56 25 4
gpt4 key购买 nike

在 Visual Studio Code 中,File > Preferences > Keyboard Shortcuts Menu,我可以覆盖 keybindings.json 中的默认绑定(bind)。但是如何在一个键上添加多个绑定(bind)呢?我不想在按下 ctrl+s

时执行保存和格式化代码之类的操作

{ "key": "ctrl+s","command": "workbench.action.files.save,editor.action.format"}

这可行吗?

最佳答案

据我所知,目前这是不可能的,因为第一个匹配的键盘快捷键获胜(从下到上搜索)并且没有进一步的快捷键被评估 - 来自 docs :

When a key is pressed:

  • the rules are evaluated from bottom to top.
  • the first rule that matches, both the key and in terms of when, is accepted.
  • no more rules are processed.
  • if a rule is found and has a command set, the command is executed.

也就是说,似乎有人有同样的愿望并为此编写了一个扩展 - 参见 gyuha.format-on-save
但是我没有亲自测试该扩展,所以我无法告诉您它的效果如何

关于keyboard-shortcuts - 在组合键上配置多个命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39524479/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com