1. fast 捷键 important 性
fast 捷键 is improvingDevelopmentefficiency important tool. 熟练usingVS Code fast 捷键可以:
- reducing鼠标operation, improving编码速度
- 保持编码approach 连续性, reducing打断
- 降 low 手腕 and 手臂 疲劳
- 提升整体Development体验
提示
不要试graph一次性记住所 has fast 捷键, 建议 from 最常用 开始, 逐步积累. using fast 捷键 频率越 high , 记忆越牢固.
2. 查看 and 自定义 fast 捷键
2.1 查看 fast 捷键
您可以through以 under 方式查看VS Code fast 捷键:
- fast 捷键面板: 按
Ctrl+K Ctrl+S(Windows/Linux) orCmd+K Cmd+S(macOS) 打开 fast 捷键面板 - commands面板: 按
Ctrl+Shift+P(Windows/Linux) orCmd+Shift+P(macOS) , 输入Keyboard Shortcuts - 菜单: 点击菜单栏 "file" > "首选项" > "键盘 fast 捷方式"
2.2 自定义 fast 捷键
such as果默认 fast 捷键不符合您 习惯, 您可以自定义:
- 打开 fast 捷键面板
- 搜索您想要modify commands
- 点击commands旁 铅笔graph标
- 按 under new fast 捷键组合
- such as果 has conflict, VS Code会提示您
- 保存更改
2.3 export and import fast 捷键configuration
您可以export自己 fast 捷键configuration, 以便 in other设备 on using:
- 打开 fast 捷键面板
- 点击 right on 角 三个点graph标
- 选择"export fast 捷键configuration"
- 保存JSONfile
- in other设备 on , 选择"import fast 捷键configuration"
3. 常用 fast 捷键classification
3.1 basic编辑 fast 捷键
这些 fast 捷键用于basic 文本编辑operation:
| fast 捷键 | functions |
|---|---|
Ctrl+X (Windows/Linux) Cmd+X (macOS) |
cut行 (未选in文本时) |
Ctrl+C (Windows/Linux) Cmd+C (macOS) |
copy行 (未选in文本时) |
Ctrl+V (Windows/Linux) Cmd+V (macOS) |
paste |
Ctrl+Shift+K (Windows/Linux) Cmd+Shift+K (macOS) |
delete行 |
Ctrl+Enter (Windows/Linux) Cmd+Enter (macOS) |
in under 方插入行 |
Ctrl+Shift+Enter (Windows/Linux) Cmd+Shift+Enter (macOS) |
in on 方插入行 |
Alt+↑ (Windows/Linux) Option+↑ (macOS) |
向 on move行 |
Alt+↓ (Windows/Linux) Option+↓ (macOS) |
向 under move行 |
Shift+Alt+↑ (Windows/Linux) Shift+Option+↑ (macOS) |
向 on copy行 |
Shift+Alt+↓ (Windows/Linux) Shift+Option+↓ (macOS) |
向 under copy行 |
Tab |
indent |
Shift+Tab |
反indent |
Ctrl+Shift+/code> (Windows/Linux) |
跳转 to 匹配 括号 |
3.2 选择 fast 捷键
这些 fast 捷键用于选择文本:
| fast 捷键 | functions |
|---|---|
Shift+↑ |
向 on 选择行 |
Shift+↓ |
向 under 选择行 |
Ctrl+Shift+↑ (Windows/Linux) Cmd+Shift+↑ (macOS) |
选择 to 行首 |
Ctrl+Shift+↓ (Windows/Linux) Cmd+Shift+↓ (macOS) |
选择 to 行尾 |
Ctrl+Shift+← (Windows/Linux) Cmd+Shift+← (macOS) |
向 left 选择单词 |
Ctrl+Shift+→ (Windows/Linux) Cmd+Shift+→ (macOS) |
向 right 选择单词 |
Ctrl+A (Windows/Linux) Cmd+A (macOS) |
选择全部 |
Ctrl+L (Windows/Linux) Cmd+L (macOS) |
选择当 before 行 |
Ctrl+Shift+L (Windows/Linux) Cmd+Shift+L (macOS) |
选择所 has 匹配项 |
Ctrl+D (Windows/Linux) Cmd+D (macOS) |
选择 under 一个匹配项 |
Alt+Click (Windows/Linux) Option+Click (macOS) |
添加 many 个光标 |
3.3 导航 fast 捷键
这些 fast 捷键用于 in 编辑器in导航:
| fast 捷键 | functions |
|---|---|
Ctrl+G (Windows/Linux) Cmd+G (macOS) |
跳转 to 行号 |
Ctrl+P (Windows/Linux) Cmd+P (macOS) |
fast 速打开file |
Ctrl+Shift+O (Windows/Linux) Cmd+Shift+O (macOS) |
跳转 to 符号 |
Ctrl+T (Windows/Linux) Cmd+T (macOS) |
跳转 to 所 has 符号 |
F12 |
跳转 to 定义 |
Alt+F12 (Windows/Linux) Option+F12 (macOS) |
查看定义 |
Shift+F12 |
find所 has 引用 |
Ctrl+F12 (Windows/Linux) Cmd+F12 (macOS) |
跳转 to implementation |
Ctrl+- (Windows/Linux) Cmd+- (macOS) |
向 after 跳转 |
Ctrl+Shift+- (Windows/Linux) Cmd+Shift+- (macOS) |
向 before 跳转 |
Ctrl+Shift+M (Windows/Linux) Cmd+Shift+M (macOS) |
查看issues面板 |
3.4 搜索 and replace fast 捷键
这些 fast 捷键用于搜索 and replace文本:
| fast 捷键 | functions |
|---|---|
Ctrl+F (Windows/Linux) Cmd+F (macOS) |
find |
Ctrl+H (Windows/Linux) Cmd+Option+F (macOS) |
replace |
Ctrl+Shift+F (Windows/Linux) Cmd+Shift+F (macOS) |
in file夹in搜索 |
Ctrl+Shift+H (Windows/Linux) Cmd+Shift+Option+F (macOS) |
in file夹inreplace |
F3 |
find under 一个 |
Shift+F3 |
find on 一个 |
Alt+Enter (Windows/Linux) Option+Enter (macOS) |
选择所 has 匹配项 |
3.5 编辑器management fast 捷键
这些 fast 捷键用于management编辑器:
| fast 捷键 | functions |
|---|---|
Ctrl+W (Windows/Linux) Cmd+W (macOS) |
关闭编辑器 |
Ctrl+K W (Windows/Linux) Cmd+K W (macOS) |
关闭所 has 编辑器 |
Ctrl+K Ctrl+W (Windows/Linux) Cmd+K Cmd+W (macOS) |
关闭工作区 |
Ctrl+\ (Windows/Linux) Cmd+\ (macOS) |
拆分编辑器 |
Ctrl+1/2/3 (Windows/Linux) Cmd+1/2/3 (macOS) |
切换 to 第1/2/3个编辑器组 |
Ctrl+K ←/→ (Windows/Linux) Cmd+K ←/→ (macOS) |
切换 to left 侧/ right 侧编辑器组 |
Ctrl+Tab (Windows/Linux) Cmd+Tab (macOS) |
切换编辑器tag页 |
3.6 视graphmanagement fast 捷键
这些 fast 捷键用于managementVS Code 视graph:
| fast 捷键 | functions |
|---|---|
Ctrl+B (Windows/Linux) Cmd+B (macOS) |
显示/隐藏侧edge栏 |
Ctrl+J (Windows/Linux) Cmd+J (macOS) |
显示/隐藏面板 |
Ctrl+Shift+E (Windows/Linux) Cmd+Shift+E (macOS) |
显示fileresourcemanagement器 |
Ctrl+Shift+G (Windows/Linux) Cmd+Shift+G (macOS) |
显示sourcescodemanagement |
Ctrl+Shift+D (Windows/Linux) Cmd+Shift+D (macOS) |
显示run and debug |
Ctrl+Shift+X (Windows/Linux) Cmd+Shift+X (macOS) |
显示scale |
Ctrl+Shift+U (Windows/Linux) Cmd+Shift+U (macOS) |
显示test |
4. many 光标编辑
VS Codesupport many 光标编辑, 允许您同时 in many 个位置编辑文本:
4.1 添加 many 个光标
- Alt+Click (Windows/Linux) or Option+Click (macOS) : in 任意位置添加光标
- Shift+Alt+↑/↓ (Windows/Linux) or Shift+Option+↑/↓ (macOS) : in 当 before 光标 on 方/ under 方添加光标
- Ctrl+Shift+L (Windows/Linux) or Cmd+Shift+L (macOS) : in 所 has 匹配项处添加光标
- Ctrl+D (Windows/Linux) or Cmd+D (macOS) : 选择 under 一个匹配项并添加光标
4.2 many 光标编辑techniques
- using many 光标同时modifyvariable名
- 同时编辑 many 行code 相同位置
- 批量添加 or deletecomment
- 同时编辑array or object many 个元素
5. commands面板efficiency
commands面板 is VS Code 强 big tool, 可以访问几乎所 has commands:
- 按
Ctrl+Shift+P(Windows/Linux) orCmd+Shift+P(macOS) 打开commands面板 - 输入commands名称 or 关键词
- using on under 箭头键选择commands
- 按Enter键执行选in commands
提示
commands面板support模糊匹配, 您不需要输入完整 commands名称, 只需要输入关键词即可.
6. otherefficiency提升techniques
6.1 code片段 (Snippets)
code片段可以 fast 速插入常用 code模板:
- 输入片段 before 缀, 然 after 按
Tab键unfold - 例such as, in JavaScriptfilein输入
for然 after 按Tab, 会unfold for for循环模板 - 您可以creation自定义code片段
6.2 quick fix (Quick Fix)
当codein has error or warning时, VS Code会显示 small 灯泡graph标, 提示quick fixsolutions:
- 将鼠标悬停 in error or warning on
- 点击 small 灯泡graph标, or 按
Ctrl+.(Windows/Linux) orCmd+.(macOS) - 选择合适 修复solutions
6.3 自动补全
VS Codeproviding智能自动补全functions:
- variable名补全
- function名补全
- property名补全
- importmodule补全
- 按
Ctrl+Space手动触发补全
7. 练习
练习 1: basic编辑 fast 捷键
- creation一个 new 文本file
- 输入几行文本
- using
Ctrl+X(Windows/Linux) orCmd+X(macOS) cut一行 - using
Ctrl+V(Windows/Linux) orCmd+V(macOS) paste - using
Ctrl+Enter(Windows/Linux) orCmd+Enter(macOS) in under 方插入行 - using
Alt+↑/↓(Windows/Linux) orOption+↑/↓(macOS) move行 - using
Shift+Alt+↑/↓(Windows/Linux) orShift+Option+↑/↓(macOS) copy行
练习 2: many 光标编辑
- creation一个 new JavaScriptfile
- 输入以 under code:
const name1 = "Alice"; const name2 = "Bob"; const name3 = "Charlie"; const name4 = "David"; - using
Ctrl+D(Windows/Linux) orCmd+D(macOS) 选择所 hasnamevariable - 将所 has
namevariable改 forusername - using
Alt+Click(Windows/Linux) orOption+Click(macOS) in 每行末尾添加光标 - 同时 in 每行末尾添加
;
练习 3: 导航 and 搜索
- 打开一个较 long codefile (such as果没 has , 可以creation一个)
- using
Ctrl+G(Windows/Linux) orCmd+G(macOS) 跳转 to 第50行 - using
Ctrl+Shift+O(Windows/Linux) orCmd+Shift+O(macOS) 查看filein 符号 - 跳转 to 某个function 定义
- using
Ctrl+F(Windows/Linux) orCmd+F(macOS) 搜索某个关键词 - using
Ctrl+Shift+F(Windows/Linux) orCmd+Shift+F(macOS) in file夹in搜索
练习 4: commands面板
- 打开commands面板
- usingcommands面板打开设置
- usingcommands面板更改主题
- usingcommands面板installation一个scale
- usingcommands面板打开终端
- usingcommands面板保存所 has file