我们在键盘上留下的余温, 也将随时代传递到更远的将来


:D 获取中...

快捷键

注: + 表示需要点击下一个键时, 上一个或多个键仍是按下去状态; 空格 表示点击下一个键时, 上一个或多个键可以放开

  • C: cmd / ctrl
  • S: shift
  • O: option / alt
  • D: Delete(Mac 自带键盘没有)
  • B: Backspace(Mac 自带键盘的 delete)
  • E: Enter(Mac 自带键盘的 return)
  • H: Home
  • Ed: End
  • ↑: UpArrow(上箭头)
  • ↓: DownArrow(下箭头)
  • ←: LeftArrow(左箭头)
  • →: RightArrow(右箭头)
  • CT: control / ctrl

系统:

资源管理器 Explorer

快捷键 作用
C + S + e 切换到资源管理器
注: 以下快捷键只有切换到资源管理器才可以生效
CT + R 最近文件列表
C + O + r (Mac) / O + S + r (win) 打开所在文件夹
C + S + t 重新打开已关闭的文件并编辑
C + k f 关闭文件夹
C + k p / C + O + 字母 c 复制文件路径
C + O + S + 字母 c 复制文件相对路径
CT + q 快速打开视图

移动光标

快捷键 作用
C + ← 将光标定位到当前行的最左侧
C + → 将光标定位到当前行的最右侧
O + ← 将光标定位到当前单词的左侧单词
O + → 将光标定位到当前单词的右侧单词
CT + g 转到行
C + u 将光标的移动回退到上一个位置
C + S + 字母 O 转到文件中的符号, 可以通过冒号来进行分组 :@:
CT + S + [ 转到括号
CT + S + ] 选中括号中到内容
C + t 转到工作区的符号

删除

快捷键 作用
C + D 删除光标之前的整行内容
C + B 删除光标之后的整行内容
O + D / CT + B 删除光标之前的一个单词
O + B / CT + D 删除光标之后的一个单词
C + d 删除整行

编辑

快捷键 作用
C + ↑ 向上复制行
C + ↓ 向下复制行
O + ↑ 向上移动行
O + ↓ 向下移动行
C + E 在光标下面插入行
C + [ 行减少缩进
C + ] 行缩进
O + 鼠标左键 多行编辑 (适用于每行编辑位置不一样)
S + O + ↑ / ↓ 多行编辑 (适用于每行编辑位置都一样)
O + d 选中当前光标所在字符, 或者选中当前已选择字符的下一个出现位置, 并进入多列编辑模式
O + S + i 选中一堆文本后, 即可在每一行的末尾都创建一个光标
C + i / C + l 选中当前行
CT + space 触发建议

查找替换

快捷键 作用
C + f 查找(光标在搜索框里)
O + E 查找后使用此快捷键可以立即选择所有查找结果
F3 or C + g 查找下一个(如果使用 C + f 查找后再用此快捷键查找, 光标在搜索框里; 如果直接使用此快捷键, 默认查找上一个关键字, 光标在编辑器里)
S + F3 or C + S + g 查找上一个(备注同上)
上一个搜索关键词 history.showPrevious
下一个搜索关键词 history.showNext
O + C + 字母 c 切换是否区分大小写 toggleSearchCaseSensitive
O + C + w 切换是否全字匹配 toggleSearchWholeWord
O + C + r 切换是否正则匹配 toggleSearchRegex
Esc 当焦点在查找弹窗组件时, 退出查找
S + Esc 当焦点不在查找弹窗组件时, 退出查找
C + h 替换
C + S + f 在文件中查找
跳转搜索结果
搜索编辑
C + S + L 将光标添加到文本搜索的所有匹配项
当焦点在搜索结果时, 跳转到上一个搜索结果
当焦点在搜索结果时, 跳转到下一个搜索结果
F4 无论焦点是否在搜索结果, 跳转到下一个搜索结果
S + F4 无论焦点是否在搜索结果, 跳转到上一个搜索结果
C + S + h 在文件中替换
C + F2 批量替换当前文件中所有匹配的文本

格式化

快捷键 作用
S + O + f 格式化文件
C + k C + f 格式化选中代码
C + k C + x 剪裁尾随空格

折叠展开

快捷键 作用
C + k C + [ 折叠所有子区域代码
C + k C + ] 展开所有子区域代码
C + O + [ 折叠光标处最内部的未折叠区域
C + O + ] 展开光标处的折叠区域
C + k C + 数字 0 折叠编辑器中的所有区域
C + k C + j 展开编辑器中的所有区域
S + Click 第一次在折叠指示器上先折叠内部范围. 再次(当所有内部范围都已折叠时)将折叠父级. 再次展开一切. https://code.visualstudio.com/updates/v1_42#_folding-refinements

js 相关

快捷键 作用
O + S + / 切换块注释
C + / 切换行注释
F8 跳转到下一个 Error 或 Warning
F12 跳转到变量或者函数定义处
O + F12 在缩略图中显示变量或者函数的定义和引用
S + O + F12 在左侧 References 中显示变量或者函数的定义和引用
S + O + 字母 O 删除未使用的导入并对剩余的导入进行排序, 该命令适用于 JavaScript 和 TypeScript 的 ES6 模块.
C + j 将多行代码合并为一行

其他

快捷键 作用
C + S + p or F1 打开命令面板
C + p 快速打开文件, 快速打开重写
C + S + t 重新打开关闭的编辑页面
C + k v 打开侧边预览
C + b 切换侧栏可见性
C + j / CT + ` 切换终端面板

插件

快捷键 作用 插件名
C + k f mac 在 Finder 中打开当前文件夹 Open in Finder
C + k C + f mac 在 Finder 中打开当前项目根目录 Open in Finder
C + k i mac 在 iTerm 中打开当前文件夹 Open in Terminal
C + k r mac 在 iTerm 中打开当前项目根目录 Open in Terminal
win: CT + O + i, mac: CT + C + i 文件头部注释 koroFileHeader
win: CT + O + t, mac: CT + C + t 函数注释 koroFileHeader
CT + O + n 运行代码 Code Runner
O + . 跳转到当前可见屏幕上的字符之后 MetaGo
O + , 跳转到当前可见屏幕上的字符之前 MetaGo
O + / 跳转到当前可见屏幕上的字符 MetaGo
O + S + / 从光标选择到当前可见屏幕上的字符 MetaGo
O + ‘ 在光标位置设置书签 MetaGo
O + [ 转到上一个书签 MetaGo
O + ] 转到下一个书签 MetaGo
O + \ 列出书签并显示管理菜单 MetaGo
O + m 将当前行滚动到屏幕中心 MetaGo
O + t 将当前行滚动到屏幕顶部 MetaGo
O + b 将当前行滚动到屏幕底部 MetaGo
CT + 字母 o 选择上一行 MetaGo
CT/C + l 选择下一行 MetaGo
C + S + \ 在代码块之间移动光标 MetaGo
O + H 将光标移动到上面的空白行 MetaGo
O + Ed 将光标移动到下面的空白行 MetaGo
O + S + H 从光标处选择到上面的空白行 MetaGo
O + S + Ed 从光标处选择到下面的空白行 MetaGo
C + ‘ 在引号之间进行切换 Toggle Quotes
O + S + E 对象键值优化: 自动换行并且在上一个键值对末尾加逗号 vue-helper
O + x 快速选中 attrs 或 代码块 vue-helper

设置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
// 将键绑定放入此文件中以覆盖默认值
[
// 切换块注释
{
"key": "shift+alt+/",
"command": "editor.action.blockComment",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+a",
"command": "-editor.action.blockComment",
"when": "editorTextFocus && !editorReadonly"
},
// 插件 Nest Comments
// 完美解决需要注释的代码里已有注释代码
{
"key": "shift+alt+/",
"command": "extension.nestComments",
"when": "editorHasSelection && editorTextFocus"
},
{
"key": "alt+cmd+/",
"command": "-extension.nestComments",
"when": "editorHasSelection && editorTextFocus"
},
{
"key": "ctrl+alt+/",
"command": "-extension.nestComments",
"when": "editorHasSelection && editorTextFocus"
},
// 删除行
{
"key": "cmd+d",
"command": "editor.action.deleteLines",
"when": "isMac && textInputFocus && !editorReadonly"
},
{
"key": "shift+cmd+k",
"command": "-editor.action.deleteLines",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "ctrl+d",
"command": "editor.action.deleteLines",
"when": "isWindows && textInputFocus && !editorReadonly"
},
{
"key": "ctrl+shift+k",
"command": "-editor.action.deleteLines",
"when": "textInputFocus && !editorReadonly"
},
// 向上复制行
{
"key": "cmd+up",
"command": "editor.action.copyLinesUpAction",
"when": "isMac && editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+up",
"command": "editor.action.copyLinesUpAction",
"when": "isWindows && editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+up",
"command": "-editor.action.copyLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
},
// 向下复制行
{
"key": "cmd+down",
"command": "editor.action.copyLinesDownAction",
"when": "isMac && editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+down",
"command": "editor.action.copyLinesDownAction",
"when": "isWindows && editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+down",
"command": "-editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
// 替换
{
"key": "cmd+h",
"command": "editor.action.startFindReplaceAction"
},
{
"key": "alt+cmd+f",
"command": "-editor.action.startFindReplaceAction"
},
// 向下多选多行编辑
{
"key": "shift+alt+down",
"command": "cursorColumnSelectDown",
"when": "textInputFocus"
},
{
"key": "shift+alt+cmd+down",
"command": "-cursorColumnSelectDown",
"when": "textInputFocus"
},
{
"key": "ctrl+shift+alt+down",
"command": "-cursorColumnSelectDown",
"when": "textInputFocus"
},
// 向上多选多行编辑
{
"key": "shift+alt+up",
"command": "cursorColumnSelectUp",
"when": "textInputFocus"
},
{
"key": "shift+alt+cmd+up",
"command": "-cursorColumnSelectUp",
"when": "textInputFocus"
},
{
"key": "ctrl+shift+alt+up",
"command": "-cursorColumnSelectUp",
"when": "textInputFocus"
},
// 选中当前光标所在字符, 或者选中当前已选择字符的下一个出现位置, 并进入多列编辑模式
{
"key": "alt+d",
"command": "editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
},
{
"key": "cmd+d",
"command": "-editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
},
{
"key": "ctrl+d",
"command": "-editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
},
// 转到括号
{
"key": "ctrl+shift+[",
"command": "editor.action.jumpToBracket",
"when": "editorTextFocus"
},
{
"key": "shift+cmd+\\",
"command": "-editor.action.jumpToBracket",
"when": "editorTextFocus"
},
{
"key": "shift+ctrl+\\",
"command": "-editor.action.jumpToBracket",
"when": "editorTextFocus"
},
// 选择括号所有内容
{
"key": "ctrl+shift+]",
"command": "editor.action.selectToBracket",
"when": "editorFocus"
},
// windows 切换是否区分大小写
{
"key": "ctrl+alt+c",
"command": "toggleFindCaseSensitive",
"when": "isWindows && editorFocus"
},
{
"key": "alt+c",
"command": "-toggleFindCaseSensitive",
"when": "editorFocus"
},
{
"key": "ctrl+alt+c",
"command": "toggleSearchCaseSensitive",
"when": "isWindows && searchViewletFocus && searchViewletVisible && !fileMatchOrFolderMatchFocus"
},
{
"key": "alt+c",
"command": "-toggleSearchCaseSensitive",
"when": "searchViewletFocus && searchViewletVisible && !fileMatchOrFolderMatchFocus"
},
// windows 切换是否全字匹配
{
"key": "ctrl+alt+w",
"command": "toggleFindWholeWord",
"when": "isWindows && editorFocus"
},
{
"key": "alt+w",
"command": "-toggleFindWholeWord",
"when": "editorFocus"
},
{
"key": "ctrl+alt+w",
"command": "toggleSearchWholeWord",
"when": "isWindows && searchViewletFocus && searchViewletVisible"
},
{
"key": "alt+w",
"command": "-toggleSearchWholeWord",
"when": "searchViewletFocus && searchViewletVisible"
},
// windows 切换是否正则匹配
{
"key": "ctrl+alt+r",
"command": "toggleFindRegex",
"when": "isWindows && editorFocus"
},
{
"key": "alt+r",
"command": "-toggleFindRegex",
"when": "editorFocus"
},
{
"key": "ctrl+alt+r",
"command": "toggleSearchRegex",
"when": "isWindows && searchViewletFocus && searchViewletVisible"
},
{
"key": "alt+r",
"command": "-toggleSearchRegex",
"when": "searchViewletFocus && searchViewletVisible"
},
// 折叠光标处未折叠区域
{
"key": "ctrl+alt+[",
"command": "editor.fold",
"when": "isWindows && editorTextFocus && foldingEnabled"
},
{
"key": "ctrl+shift+[",
"command": "-editor.fold",
"when": "editorTextFocus && foldingEnabled"
},
{
"key": "ctrl+alt+]",
"command": "editor.unfold",
"when": "isWindows && editorTextFocus && foldingEnabled"
},
{
"key": "ctrl+shift+]",
"command": "-editor.unfold",
"when": "editorTextFocus && foldingEnabled"
},
// Open in Finder
{
"key": "cmd+k f",
"command": "openInFinder.open",
"when": "isMac"
},
{
"key": "cmd+k cmd+f",
"command": "openInFinder.openRoot",
"when": "isMac"
},
// open in terminal
{
"key": "cmd+k i",
"command": "openInTerminal.open",
"when": "isMac"
},
{
"key": "cmd+k r",
"command": "openInTerminal.openRoot",
"when": "isMac"
},
// Dash
{
"key": "ctrl+s",
"command": "extension.dash.specific",
"when": "isMac && editorTextFocus"
},
{
"key": "ctrl+h",
"command": "-extension.dash.specific",
"when": "isMac && editorTextFocus"
},
{
"key": "ctrl+alt+s",
"command": "extension.dash.all",
"when": "isMac && editorTextFocus"
},
{
"key": "ctrl+alt+h",
"command": "-extension.dash.all",
"when": "isMac && editorTextFocus"
},
// 替换 vim 快捷键
// {
// "key": "ctrl+shift+j",
// "command": "extension.vim_ctrl+j",
// "when": "editorTextFocus && vim.active && vim.use<C-j> && !inDebugRepl"
// },
// {
// "key": "ctrl+j",
// "command": "-extension.vim_ctrl+j",
// "when": "editorTextFocus && vim.active && vim.use<C-j> && !inDebugRepl"
// },
// 插件 Turbo Console Log 增加 Mac 快捷键, 方便和 Windows 一样
{
"key": "alt+cmd+l",
"command": "turboConsoleLog.displayLogMessage",
"when": "isMac && editorTextFocus"
},
// ctrl/cmd+j 合并行
{
"key": "ctrl+j",
"command": "editor.action.joinLines",
"when": "isWindows && editorTextFocus && !editorReadonly"
},
{
"key": "cmd+j",
"command": "editor.action.joinLines",
"when": "isMac && editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+j",
"command": "-editor.action.joinLines",
"when": "editorTextFocus && !editorReadonly"
},
// 去掉 ctrl+o 新建下一行
{
"key": "",
"command": "lineBreakInsert",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "ctrl+o",
"command": "-lineBreakInsert",
"when": "textInputFocus && !editorReadonly"
}
]

所有 VS Code 快捷键的 PDF 文件:


 评论

 无法加载Disqus评论系统,请确保您的网络能够正常访问。