VSCode默认用Ctrl + /注释一行时,光标停留在该行中。下面介绍如何注释后,光标会自动移动到下一行。
1.【View】 ->【Extensions】->【查找并安装Multi-command 扩展】
2.【File 】 -> 【Preferences 】->【Keyboard Shortcuts】(macOS :Code ,Preferences ,Keyboard Shortcuts)
3.【在搜索栏里面搜索 Open Keyboard Shortcuts (JSON)】->【去到别的文件下,打开Keybinding.json】
如果Keybinding是空的,则自己随便设置一个快捷键,去到别的文件下,按下快捷键打开keybindings.json
4.在keybindings.json文件下添加以下代码
[
{
"key": "ctrl+/",
"command": "extension.multiCommand.execute",
"args": {
"sequence": [
"editor.action.commentLine",
"cursorDown"
]
},
"when": "editorTextFocus"
}
]
5.其他常用按键配置
{
"key": "ctrl+d",
"command": "editor.action.deleteLines",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+down",
"command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus"
}