在 VS Code 中,快捷键“Ctrl + A”选择文档中的所有内容。我习惯了更渐进的选择系统,例如 Microsoft OneNote,其中 Ctrl + A 的行为方式如下:
在完美的世界中,我想要一些方法,以便我可以在 .json 文件中重新绑定 Ctrl + A,以便从默认光标位置执行以下操作:
不知道有没有选择当前单词的命令。我确实知道有一个用于选择当前行的命令(Ctrl + L,expandLineSelection)。我认为逐步改变命令功能的方法是修改命令每个级别的 when 部分,但我什至不知道从哪里开始
starball的建议与我想要实现的目标足够接近,所以我将使用它。重申;命令是“editor.action.smartSelect.expand”,我只需编辑 Json 文件以禁用原始命令,并将新命令与默认快捷键 (Alt + Shift + RightArrow) 结合使用。
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+a",
"command": "editor.action.smartSelect.expand",
"when": "textInputFocus"
},
{
"key": "ctrl+a",
"command": "-editor.action.selectAll"
}
]