Visual Studio Code 中使 Home 键转到行首的选项在哪里?
现在你必须做
首页,首页
或
主页,Ctrl+向左箭头
我希望 home 位于队列的开头。
文件→首选项→键盘快捷键:
cursorHome
和cursorHomeSelect
cursorLineStart
,然后
点击添加快捷方式然后按Home然后输入cursorLineStartSelect
执行相同操作,但按 Shift-Home我认为没有任何内置选项可以更改 Home 的当前行为,但您可以借助宏扩展轻松地自行更改它,例如 multi-command (在
keybindings.json
中):
{
"key": "home",
"command": "extension.multiCommand.execute",
"args": {
"sequence": [
"cursorHome",
"cursorHome"
]
},
"when": "editorTextFocus"
}
现在按一次Home与按两次效果相同。
更简洁的方法是给出命令
cursorLineStart
Home 键绑定:
{
"key": "home",
"command": "cursorLineStart",
"when": "editorTextFocus"
},
可以从按键绑定快捷方式执行此操作,也可以手动将其添加到您的
keybindings.json
。
基于@Mark的答案,这是我的“keybindings.json”文件,它更改了 home / end 键的行为,以在按下 home 或 end 键时转到行的开头或结尾。这模拟了 ubuntu 中 vscode 的行为。
[
{
"key": "home",
"command": "cursorLineStart",
"when": "editorTextFocus"
},
{
"key": "end",
"command": "cursorLineEnd",
"when": "editorTextFocus"
},
]