1、VSCode 中打开 命令面板 ,如下图所示。
2)在命令面板中输入 keyboard
在命令面板中输入 keyboard ,然后在列表中选择 首选项:打开键盘快捷方式(JSON) :
3)打开 首选项:打开键盘快捷方式(JSON)
点击 首选项:打开键盘快捷方式(JSON) ,打开 keybindings.json 配置文件。
keybindings.json 的实际路径格式为
C:\Users\ 【用户】\AppData\Roaming\Code\User\
例如:
C:\Users\Administrator\AppData\Roaming\Code\User\
C:\Users\zhangsan\AppData\Roaming\Code\User\
如下图所示:
4)在 keybindings.json 中配置 快捷键
配置1(常用的快捷键)
[
{
"key": "ctrl+d",
"command": "-editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
},
{
"key": "ctrl+d",
"command": "editor.action.deleteLines",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "ctrl+shift+k",
"command": "-editor.action.deleteLines",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "ctrl+alt+up",
"command": "editor.action.copyLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+up",
"command": "-editor.action.copyLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+alt+down",
"command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+down",
"command": "-editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+enter",
"command": "editor.action.insertLineAfter",
"when": "editorTextFocus && !editorReadonly"
}
]
配置2(最全的快捷键)
[
{
"key": "ctrl+i",
"command": "expandLineSelection",
"when": "editorTextFocus"
},
{
"key": "ctrl+y",
"command": "redo",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+k ctrl+c",
"command": "editor.action.addCommentLine",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+shift+k",
"command": "editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
},
{
"key": "ctrl+shift+/",
"command": "editor.action.blockComment",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+alt+down",
"command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+alt+up",
"command": "editor.action.copyLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+d",
"command": "editor.action.deleteLines",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+alt+l",
"command": "editor.action.formatDocument",
"when": "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+k ctrl+f",
"command": "editor.action.formatSelection",
"when": "editorHasDocumentSelectionFormattingProvider && editorHasSelection && editorTextFocus && !editorReadonly"
},
{
"key": "f12",
"command": "editor.action.goToDeclaration",
"when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
},
{
"key": "ctrl+f12",
"command": "editor.action.goToImplementation",
"when": "editorHasImplementationProvider && editorTextFocus && !isInEmbeddedEditor"
},
{
"key": "shift+alt+up",
"command": "editor.action.insertCursorAbove",
"when": "editorTextFocus"
},
{
"key": "shift+alt+down",
"command": "editor.action.insertCursorBelow",
"when": "editorTextFocus"
},
{
"key": "shift+enter",
"command": "editor.action.insertLineAfter",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "alt+/",
"command": "editor.action.triggerSuggest",
"when": "editorHasCompletionItemProvider && editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+f",
"command": "rest-client.rerun-last-request",
"when": "editorTextFocus && editorLangId == 'http'"
},
{
"key": "shift+alt+f",
"command": "rest-client.rerun-last-request",
"when": "editorTextFocus && editorLangId == 'plaintext'"
},
{
"key": "shift+alt+f",
"command": "rest-client.rerun-last-request",
"when": "resourceScheme == 'rest-response'"
},
{
"key": "ctrl+.",
"command": "workbench.action.togglePanel"
},
{
"key": "ctrl+enter",
"command": "workbench.action.tasks.build"
}
]
|