469 - 《VSCode 快捷键技巧》
发布于 2024年10月10日
通过 , 前缀的方式定义额外的快捷键,比如在侧栏打开定义代码、在 github 打开当前文件、打开当前项目的 package.json 等。
1、上午学到的一个技巧,感觉有用。方法是通过 keybindings.json 定义一些额外的常用快捷键,具体定义啥看个人喜好了,我的全部配置如下,可以直接抄作业。
// keybindings.json
// e = edit
// o = open
[
{ "key": ", ,", "command": "type", "args": { "text": "," } },
{ "key": ", .", "command": "editor.action.revealDefinition" },
{ "key": ", e c", "command": "editor.action.transformToCamelcase" },
{ "key": ", e m", "command": "editor.action.sourceAction", "args": { "kind": "source.addMissingImports", "apply": "first" } },
{ "key": ", e r", "command": "editor.action.sourceAction", "args": { "kind": "source.removeUnusedImports", "apply": "first" } },
{ "key": ", e s", "command": "editor.action.sortLinesAscending" },
{ "key": ", o g", "command": "gitlens.openFileInRemote" },
{ "key": ", o k", "command": "workbench.action.openGlobalKeybindingsFile" },
{ "key": ", o t", "command": "workbench.action.terminal.toggleTerminal" },
{ "key": ", o p", "command": "workbenc