深色模式
VSCode常用快捷键
说明
如果经常同时使用VSCode和JetBrains系列IDE(WebStorm、Goland、Android Studio等),最好把相同(或相似)操作的快捷键设置为一样的。
以下列出了常用的操作,以及它们在两种名称,方便查找并修改快捷键。
常用操作
shortcut栏,代表个人习惯,仅供参考。名称栏为空,代表没有对应的相同功能。
光标与选中:
shortcut | VSCode | JetBrains | 功能 |
---|---|---|---|
⌥ Click | [default] | Add or Remove Caret | 鼠标插入光标 |
⌥ ↑ | Add Cursor Above | Clone Caret Above | 向上插入光标 |
⌥ ↓ | Add Cursor Below | Clone Caret Below | 向下插入光标 |
⌥ ← | cursorWordLeft | Move Caret to Previous Word | 光标左移一个词 |
⌥ → | cursorWordEndRight | Move Caret to Next Word | 光标右移一个词 |
⌘ ← | cursorHome | Move Caret to Line Start | 光标移到行首 |
⌘ → | cursorEnd | Move Caret to Line End | 光标移到行尾 |
⌘ L | cursorRight | Right | 光标向右 |
⇧ ⌘ Enter | Inser Line Above | Start New Line Before Current | 向上插入行 |
⇧ Enter | Insert Line Below | Start New Line | 向下插入行 |
⌘ E | Expand Selection | Extend Selection | 增加选中范围 |
Shrink Selection | Shrink Selection | 减少选中范围 |
代码编辑:
shortcut | VSCode | JetBrains | 功能 |
---|---|---|---|
⌘ ⌥ ↑ | Move Line Up | Move Line Up | 向上移动当前行 |
⌘ ⌥ ↓ | Move Line Down | Move Line Down | 向下移动当前行 |
Copy Line Up | 向上复制行 | ||
⇧ ⌘ D | Copy Line Down | Duplicate Line or Selection | 向下复制行 |
⌥ ⌘ J | Join Lines | Join Lines | 合并行 |
⌘ D | Delete Line | Delete Line | 删除行 |
⌘ Backspace | Delete All Left | Delete to Line Start | 删除左边所有 |
⌘ Delete | Delete All Right | Delete to Line End | 删除右边所有 |
⌥ Backspace | deleteWordLeft | Delete to Word Start | 删除左边单词 |
⌥ Delete | deleteWordRight | Delete to Word End | 删除右边单词 |
代码输入:
shortcut | VSCode | JetBrains | 功能 |
---|---|---|---|
⌘ G | Quick Fix | Show Context Actions | 快速操作 |
⌘ Space | Complete Current Statement | 完成语句 | |
⌘ R , T | Refactor | Refactor This | 重构 |
⌘ R , R | Rename Symbol | Refactor -> Rename | 重命名 |
⌘ R , E | Change All Occurrences | 文本替换 | |
⌘ R , S | Sort Members | 成员排序 | |
⌘ ⌥ L | Format Document | Reformat Code | 格式化代码 |
⌘ ⌥ O | Orgnize Imports | Optimize Imports | 优化导入 |
代码分析:
shortcut | VSCode | JetBrains | 功能 |
---|---|---|---|
F1 | Peek Definition | Quick Definition | 快查定义 |
⇧ F1 | Go to Definition | Jump To Source | 跳转到定义 |
F2 | Peek Type Definition | 快查类型 | |
⇧ F2 | Go to Type Definition | 跳转到类型 | |
Peek Type Hierarchy | 快查类型树 | ||
Show Type Hierarchy | 显示类型树 | ||
F3 | Peek References | Show Usages | 快查引用 |
⇧ F3 | Go to References | Find Usages | 跳转到引用 |
⌘ F3 | Find All References | 查看所有引用 | |
Peek Call Hierarchy | 快查调用树 | ||
Show Call Hierarchy | 显示调用树 | ||
F4 | Peek Implementations | 快查实现 | |
⇧ F4 | Go to Implementations | 跳转到实现 | |
⌘ F4 | Find All Implementations | 查看所有实现 |
查找:
shortcut | VSCode | JetBrains | 功能 |
---|---|---|---|
⌘ F | Find | 查找替换 | |
⇧ ⌘ F | Find in Files | 全局查找替换 | |
⇧ ⌘ R | Replace in Files | 全局替换 |
界面切换:
shortcut | VSCode | JetBrains | 功能 |
---|---|---|---|
⌘ 1 | Show Explorer | Tool Windows -> Project | 切换到代码目录 |
⌘ 7 | Toggle Terminal | Tool Windows -> Terminal | 终端 |
⇧ ⌘ ← | Select Previous Tab | 选中上一个tab | |
⇧ ⌘ → | Select Next Tab | 选中下一个tab | |
⌘ F1 , 1 | Select In... | 打开文件位置 |