vscode中一个键盘快捷键上的多个操作 [英] Multiple actions on one keyboard shortcut in vscode
本文介绍了vscode中一个键盘快捷键上的多个操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在 Visual Studio 代码中将多个操作分配给一个键盘快捷键?
Is it possible to have multiple actions assigned to one keyboard shortcut in visual studio code?
例如:将光标向上移动 x 3 设置为ctrl + w"
For example: Move cursor up x 3 set to "ctrl + w"
提前致谢.
推荐答案
可以使用像 命令
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"
]
},
支持宏如键绑定#871的功能请求.
虽然,对于这个特定的例子,最好使用 built-in
命令(以避免任何跳跃):
Although, for this particular example it's better to use the built-in
command (to avoid any jumpiness):
{
"key": "ctrl+w",
"command": "cursorMove",
"args": {
"to": "down",
"by": "line",
"value": 3
}
}
https://code.visualstudio.com/api/references/commands
这篇关于vscode中一个键盘快捷键上的多个操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文