vscode常用快捷键
# 菜单位置
File -> Preferences -> Keyboard Shortcuts
# 写代码会经常用的一些快捷键
增加缩进: ctrl+], 我的习惯alt+]
减少缩进(outdent line): ctrl+[, 我的习惯alt+[
删除行: ctrl + shift + k
上移行: alt+up
下移行: alt+down
复制行到上面: shift+alt+up, 我的习惯ctrl+d
复制行到下面: shift+alt+down
新建行(下面): ctrl+enter, 我的习惯shift+enter
新建行(上面): ctrl+shift+enter
文件内搜索: ctrl+f
文件内替换: ctrl+h
文件夹搜索: ctrl+shift+f
文件夹替换: ctrl+shift+h
行注释: ctrl+/
块注释: shift+alt+a, 我的习惯ctrl+shift+/
重命名: f2
删除单词光标前(deleteWordLeft): ctrl+backspace
删除单词光标后(deleteWordRight): ctrl+del
光标移到前一单词: ctrl+left
光标移到后一单词: ctrl+right
上一个编辑位置(back): alt+left, 我的习惯ctrl+alt+left
下一个编辑位置(forward): alt+right, 我的习惯ctrl+alt+left
跳转到行: ctrl+g
前往标识符: ctrl+shift+o
匹配括号: ctrl+shift+\
继续: f5
单步跳过: f10
单步执行: f11
【json文件方式设置快捷键】
# ctrl+shift+p, 选择Open Keyboard Shortcuts(JSON)。要看默认的快捷键,可以选择Open Default Keyboard Shortcuts(JSON)
# 修改后的设置, keybindings.json
// Place your key bindings in this file to override the defaults [ //增加缩进: ctrl+]改为alt+] { "key": "ctrl+oem_6", "command": "-editor.action.indentLines", "when": "editorTextFocus && !editorReadonly" }, { "key": "alt+oem_6", "command": "editor.action.indentLines", "when": "editorTextFocus && !editorReadonly" }, //减少缩进: ctrl+[改为alt+[ { "key": "ctrl+oem_4", "command": "-editor.action.outdentLines", "when": "editorTextFocus && !editorReadonly" }, { "key": "alt+oem_4", "command": "editor.action.outdentLines", "when": "editorTextFocus && !editorReadonly" }, //后退: alt+左改为ctrl+alt+左 { "key": "alt+left", "command": "workbench.action.moveEditorToPreviousGroup" }, { "key": "ctrl+alt+left", "command": "workbench.action.navigateBack" }, /* { "key": "ctrl+alt+left", "command": "workbench.action.navigateToLastEditLocation" }, */ //前进: alt+右改为ctrl+alt+右 { "key": "alt+right", "command": "workbench.action.moveEditorToNextGroup" }, { "key": "ctrl+alt+right", "command": "workbench.action.navigateForward" }, //块注释:shift+alt+a改为ctrl+shift+/ { "key": "shift+alt+a", "command": "-editor.action.blockComment", "when": "editorTextFocus && !editorReadonly" }, { "key": "ctrl+shift+oem_2", "command": "editor.action.blockComment", "when": "editorTextFocus && !editorReadonly" }, //复制当前行到上面: 增加ctrl+d { "key": "ctrl+d", "command": "editor.action.copyLinesUpAction", "when": "editorTextFocus && !editorReadonly" }, { "key": "ctrl+d", "command": "-editor.action.addSelectionToNextFindMatch", "when": "editorFocus" }, //光标移到前一个单词 { "key": "ctrl+left", "command": "cursorWordPartLeft", "when": "textInputFocus && !accessibilityModeEnabled" }, { "key": "ctrl+left", "command": "-cursorWordLeft", "when": "textInputFocus && !accessibilityModeEnabled" }, //光标移到后一个单词 { "key": "ctrl+right", "command": "cursorWordPartRight", "when": "textInputFocus && !accessibilityModeEnabled" }, { "key": "ctrl+right", "command": "-cursorWordRight", "when": "textInputFocus && !accessibilityModeEnabled" }, //新建行(下面): ctrl+enter改为shift+enter { "key": "shift+enter", "command": "editor.action.insertLineAfter", "when": "editorTextFocus && !editorReadonly" }, { "key": "ctrl+enter", "command": "-editor.action.insertLineAfter", "when": "editorTextFocus && !editorReadonly" }, ]