vscode使用总结

vscode 官网使用说明

web ide 安装

参考文章

自定义代码片段

没有这个功能,vscode 不用其他编辑器好用

标识符 描述
${1:foo} 占位符,用来填写信息
`${1 a,b,c}`
${name:default} 如果name没定义,使用定义的default 变量
占位符 名字
$1 光标位置,tabstop,光标停留位置
CURRENT_YEAR 当前年份
CURRENT_MONTH 月份为两位数(例如'02’)
CURRENT_DATE 这个月的哪一天
CURRENT_HOUR 24小时时钟格式的当前小时
CURRENT_MINUTE 当前分
CURRENT_SECOND 当前秒
TM_DIRECTORY 当前文档所在的文件夹,
WORKSPACE_NAME 当前打开的工作区或者文件夹的名字.
TM_SELECTED_TEXT 前选中的文字或者空字符串,
TM_FILENAME_BASE 当前文档的文件名,不带扩展名
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
"方法注释": {
    "prefix": "zs-Function",
    "body": [
      "/**",
      " * @description description...",
      " * @param { ${1|Boolean,Number,String,Object,Array,*|} } name description...",
      " * @return { ${2|Boolean,Number,String,Object,Array,*|} } description...",
      " */",
      "$0"
    ],
    "description": "添加方法注释"
  }
 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
{
 // Place your snippets for go here. Each snippet is defined under a snippet name and has a prefix, body and 
 // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
 // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
 // same ids are connected.
 // Example:
 // "Print to console": {
 //  "prefix": "log",
 //  "body": [
 //   "console.log('$1');",
 //   "$2"
 //  ],
 //  "description": "Log output to console"
 // }
 "print": {
  "prefix": [
   "printf",
   "print",
   "echo",
   "fmt"
  ],
  "body": [
   "fmt.Printf(\"%+v\\n\",$1);",
  ],
  "description": "打印"
 },
 "import": {
  "prefix": [
   "import",
   "im",
   "i"
  ],
  "body": [
   "import (\n\t\"$1\"\n)",
  ]
 },
 "var": {
  "prefix": [
   "var"
  ],
  "body": [
   "var $1 = $2",
  ]
 },
 "if cond": {
  "prefix": "if",
  "body": [
   "if $1 {\n",
   "\t$2",
   "\n} $3"
  ],
 },
 "switch": {
  "prefix": [
   "sw"
  ],
  "body": [
   "switch $1{",
   "case $2:\n$3",
   "default:\n$4",
   "}",
  ]
 },
 "test1": {
  "prefix": "tes",
  "body": [
   "func Test_$1(t *testing.T) {\n$2\n}"
  ]
 },
 "convey": {
  "prefix": "con",
  "body": [
   "Convey(\"test_$1\", t, func() {\n$2",
   "})"
  ]
 },
 
}

添加代码助手

vscode 使用 json配置,太麻烦了,这里可以 把用 js生成 snippets配置

下载 chrome webmaker插件,把代码片段拷贝到文本库,就可以生成 snippets 的 json格式的代码了,比较方便

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<textarea id="text">
  
</textarea>




<br /> <br />
<textarea id="root">
 
</textarea>
1
2
3
4
5
textarea {
  
  width: 80vw;
  height: 300px;
}
1
2
3
4
5
6
7
8
let t = document.getElementById('text')
let root = document.getElementById('root')

t.addEventListener('change',function(e) {
  let text = e.target.value?.trim();
  let arr = text.split('\n')
  root.innerText = JSON.stringify(arr);
});

foam插件

参考文章

排除目录的方法, 在当前项目 创建 .vscode 文件夹,编辑 settings.json

1
2
3
4
5
6
7
8
9
{
    "files.exclude": {
        "**/themes": true,
        "**/node_modules": true,
    },
    "files.watcherExclude": {
        "**/even2": true
    }
}

vscode 就会自动排除文件夹,你就不用看这些文件了

bookmarks插件

目前没有找到快捷键的配置,

可以用来做快速代码跳转,很方便

参考知乎的博客

快捷键

https://blog.csdn.net/weixin_42613208/article/details/90513209

快捷键 用法
f12 快速跳到 函数定义
ctrl +t 输入函数名字,就可以快速搜索到在哪个文件定义了
ctrl+g 类似 vim 的 :number ,跳到指定行
f9 toggle breakpoint
f5 continue or start
shirt f5 stop
f10 step over
f11/shift f11 step into /out
rctrl + ` 这个经常用,焦点快速切换到 命令行界面
alt + 左右 返回/前进 Go back / forward 【浏览记录】
ctrl + p 打开历史记录
rctrl +shift + ` 创建新终端
ctrl + / 注释
ctrl+i 或者 alt+/ 显示悬停,代码提示
ctrl k +v markdown预览
ctrl k + ctrl s 显示快捷键
ctrl k z zen mode ,类似全屏模式

git插件

https://www.bilibili.com/video/BV1Y4411Z7ZH?spm_id_from=333.337.search-card.all.click

best comments插件

gitlens插件

代码片段和 代码提示冲突解决方法

1.定义自己的快捷键
2. 关闭关键字提示

比如 我定义了 type 关键字的代码片段, 结果 vscode 也有 type的片段,他会默认用自己的,我希望用我自己的,后面我关闭了 intellicode 的关键字提示功能,就解决了冲突的问题

一些常用的关键字完全可以关闭提示,比如 type ,return ,if ,else for,switch 等,很常用的东西,不可能忘记,基本用不到提示

自定义快捷键

vscode 很多快捷键都特别难记,之前学习的时候就被劝退好几次, 其实很多快捷键都没什么用,选几个快捷键修改

我觉得写代码的时候 bookmarks 插件比较重要,这里将 bookmarks 的快捷键改了
vscode快捷键参考视频

这个是stackoverflow上参考的文章

补充:

下面 是我最开始的快捷键设置,经过使用后发现,存在一些问题,比如 ctrl b b , 在输入法拼音模式下,后面的那个 b会被输入法吃掉,进入拼音选项,所以 解决的方法是 改为 ctrl b + ctrl b , 使用修饰键就不会被拼音输入法吃掉

名字 快捷键
bookmark toggle ctrl b b
bookmark next ctrl b j
bookmark prev ctrl b k
列出所有bookmark ctrl b . 或者 ctrl b l
toggle侧边栏 ctrl + j [
触发参数提醒 ctrl j h
预览定义 ctrl j p
跳转函数定义 ctrl + j j
跳转函数实现 ctrl + j l
跳转函数引用 ctrl + j k
切换面板可见性 (shell面板窗口) ctrl + j .
切换辅助栏可见性 【大纲视图】 ctrl + j o 或者 ctrl space ]
跳转指定行数 (模仿vim) ctrl + j shirt+ ;
run code ctrl j r
转到下一个错误,原f8 ctrl j n
切换标签页,ctrl j + u 或者i ctrl j + (u or i) 切换前后标签页
切换编辑器窗口,ctrl + \ 切分窗口 ctrl + e, hjkl 表示切换方向
toggle editor group sizes ctrl + e + .
切换窗口 alt w
转到工作区符号(代码符号搜索) ctrl j ctrl f,( 原 ctrl t)
切换标签页 (默认) ctrl + tab, 常用
预览顺序(默认) alt <- 或者 -> ,另外再加 ctrl [ 或 ] 切换顺序
将行移动 alt up or down
格式化文档 alt shirt f
预览markdown ctrl k V
关闭编辑器标签页 ctrl j ctrl q, 原(ctrl f4)
step over ctrl numpad6
step into ctrl numpad2
step out ctrl numpad8
start/contrinue ctrl numpad5
重新debug ctrl numpad4
ctrl \ ,切分窗格编辑器 ctrl,1,2,3 切换编辑器窗格
切换工作区 (默认) ctrl r, 和 project manager 差不多
选中当前行 (默认) ctrl l
找到所有匹配项 (默认) ctrl shift l
代码建议 alt /
ctrl [ 或者 ] 和 alt 左右同
向上下左右设置终端大小 ctrl t + (hjkl)
最大化终端 ctrl t numpad8 或者 ctrl +t m
切换 前后终端 ctrl t numpad 4 和 6
拆分终端 ctrl t .
切换终端 ctrl t t ,同ctrl + j .
打开快速视图 (默认) ctrl + q

这里是模仿 vim 的,jk作为方向键

总结经常用的, 尽量不要让 自带的快捷方式 和 自己的快捷键方式冲突, 复用快捷键的逻辑

记得同步自己的配置

  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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
// 将按键绑定配置放入此文件中即可覆盖默认值
[
    {
        "key": "backspace",
        "command": "deleteLeft",
        "when": "textInputFocus && !editorReadonly"
    },
    {
        "key": "backspace",
        "command": "-deleteLeft",
        "when": "textInputFocus && !editorReadonly"
    },
    {
        "key": "ctrl+j h",
        "command": "editor.action.triggerParameterHints",
        "when": "editorHasSignatureHelpProvider && editorTextFocus"
    },
    {
        "key": "ctrl+shift+space",
        "command": "-editor.action.triggerParameterHints",
        "when": "editorHasSignatureHelpProvider && editorTextFocus"
    },
    {
        "key": "alt+backspace",
        "command": "workbench.action.terminal.deleteWordLeft",
        "when": "terminalFocus"
    },
    {
        "key": "ctrl+backspace",
        "command": "-workbench.action.terminal.deleteWordLeft",
        "when": "terminalFocus"
    },
    {
        "key": "shift+backspace",
        "command": "-deleteLeft",
        "when": "textInputFocus && !editorReadonly"
    },
    {
        "key": "alt+oem_2",
        "command": "editor.action.triggerSuggest",
        "when": "editorHasCompletionItemProvider && textInputFocus && !editorReadonly"
    },
    {
        "key": "ctrl+space",
        "command": "-editor.action.triggerSuggest",
        "when": "editorHasCompletionItemProvider && textInputFocus && !editorReadonly"
    },
    {
        "key": "ctrl+shift+oem_2",
        "command": "editor.action.blockComment",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "shift+alt+a",
        "command": "-editor.action.blockComment",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+alt+oem_2",
        "command": "editor.action.removeCommentLine",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+k ctrl+u",
        "command": "-editor.action.removeCommentLine",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+alt+oem_2 shift+alt+oem_2",
        "command": "toggleExplainMode",
        "when": "suggestWidgetVisible"
    },
    {
        "key": "ctrl+oem_2",
        "command": "-toggleExplainMode",
        "when": "suggestWidgetVisible"
    },
    {
        "key": "ctrl+alt+oem_2",
        "command": "editor.action.addCommentLine",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+k ctrl+c",
        "command": "-editor.action.addCommentLine",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+oem_2",
        "command": "editor.action.commentLine",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+oem_2",
        "command": "-editor.action.commentLine",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "alt+enter",
        "command": "editor.action.organizeImports",
        "when": "editorTextFocus && !editorReadonly && supportedCodeAction =~ /(\\s|^)source\\.organizeImports\\b/"
    },
    {
        "key": "shift+alt+o",
        "command": "-editor.action.organizeImports",
        "when": "editorTextFocus && !editorReadonly && supportedCodeAction =~ /(\\s|^)source\\.organizeImports\\b/"
    },
    {
        "key": "alt+.",
        "command": "toggleSuggestionDetails",
        "when": "suggestWidgetVisible && textInputFocus"
    },
    {
        "key": "ctrl+space",
        "command": "-toggleSuggestionDetails",
        "when": "suggestWidgetVisible && textInputFocus"
    },
    {
        "key": "ctrl+alt+u",
        "command": "rust-analyzer.parentModule",
        "when": "editorTextFocus && editorLangId == 'rust'"
    },
    {
        "key": "ctrl+shift+u",
        "command": "-rust-analyzer.parentModule",
        "when": "editorTextFocus && editorLangId == 'rust'"
    },
    {
        "key": "ctrl+u ctrl+u",
        "command": "workbench.action.output.toggleOutput",
        "when": "workbench.panel.output.active"
    },
    {
        "key": "ctrl+shift+u",
        "command": "-workbench.action.output.toggleOutput",
        "when": "workbench.panel.output.active"
    },
    {
        "key": "ctrl+shift+u",
        "command": "editor.action.transformToUppercase"
    },
    {
        "key": "ctrl+b b",
        "command": "bookmarks.toggle",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+alt+k",
        "command": "-bookmarks.toggle",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+b j",
        "command": "bookmarks.jumpToNext",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+alt+l",
        "command": "-bookmarks.jumpToNext",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+b k",
        "command": "bookmarks.jumpToPrevious",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+alt+j",
        "command": "-bookmarks.jumpToPrevious",
        "when": "editorTextFocus"
    },
    {
        "key": "alt+w",
        "command": "workbench.action.switchWindow"
    },
    {
        "key": "ctrl+j oem_4",
        "command": "workbench.action.toggleSidebarVisibility"
    },
    {
        "key": "ctrl+b",
        "command": "-workbench.action.toggleSidebarVisibility"
    },
    {
        "key": "ctrl+k ctrl+s",
        "command": "workbench.action.openGlobalKeybindings"
    },
    {
        "key": "ctrl+k ctrl+s",
        "command": "-workbench.action.openGlobalKeybindings"
    },
    {
        "key": "ctrl+j oem_period",
        "command": "workbench.action.togglePanel"
    },
    {
        "key": "ctrl+j",
        "command": "-workbench.action.togglePanel"
    },
    {
        "key": "ctrl+l ctrl+l",
        "command": "expandLineSelection",
        "when": "textInputFocus"
    },
    {
        "key": "ctrl+l",
        "command": "-expandLineSelection",
        "when": "textInputFocus"
    },
    {
        "key": "ctrl+j j",
        "command": "editor.action.revealDefinition",
        "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
    },
    {
        "key": "f12",
        "command": "-editor.action.revealDefinition",
        "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
    },
    {
        "key": "ctrl+j k",
        "command": "editor.action.goToReferences",
        "when": "editorHasReferenceProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor"
    },
    {
        "key": "shift+f12",
        "command": "-editor.action.goToReferences",
        "when": "editorHasReferenceProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor"
    },
    {
        "key": "ctrl+j l",
        "command": "editor.action.goToImplementation",
        "when": "editorHasImplementationProvider && editorTextFocus && !isInEmbeddedEditor"
    },
    {
        "key": "ctrl+f12",
        "command": "-editor.action.goToImplementation",
        "when": "editorHasImplementationProvider && editorTextFocus && !isInEmbeddedEditor"
    },
    {
        "key": "ctrl+numpad_multiply",
        "command": "editor.unfoldAll",
        "when": "editorTextFocus && foldingEnabled"
    },
    {
        "key": "ctrl+k ctrl+j",
        "command": "-editor.unfoldAll",
        "when": "editorTextFocus && foldingEnabled"
    },
    {
        "key": "ctrl+j f",
        "command": "workbench.action.showAllSymbols"
    },
    {
        "key": "ctrl+t",
        "command": "-workbench.action.showAllSymbols"
    },
    {
        "key": "ctrl+j q",
        "command": "workbench.action.closeActiveEditor"
    },
    {
        "key": "ctrl+f4",
        "command": "-workbench.action.closeActiveEditor"
    },
    {
        "key": "ctrl+numpad5",
        "command": "workbench.action.debug.continue",
        "when": "debugState == 'stopped'"
    },
    {
        "key": "f5",
        "command": "-workbench.action.debug.continue",
        "when": "debugState == 'stopped'"
    },
    {
        "key": "ctrl+numpad5",
        "command": "workbench.action.debug.start",
        "when": "debuggersAvailable && debugState == 'inactive'"
    },
    {
        "key": "f5",
        "command": "-workbench.action.debug.start",
        "when": "debuggersAvailable && debugState == 'inactive'"
    },
    {
        "key": "ctrl+numpad2",
        "command": "workbench.action.debug.stepInto",
        "when": "debugState != 'inactive'"
    },
    {
        "key": "f11",
        "command": "-workbench.action.debug.stepInto",
        "when": "debugState != 'inactive'"
    },
    {
        "key": "ctrl+numpad8",
        "command": "workbench.action.debug.stepOut",
        "when": "debugState == 'stopped'"
    },
    {
        "key": "shift+f11",
        "command": "-workbench.action.debug.stepOut",
        "when": "debugState == 'stopped'"
    },
    {
        "key": "ctrl+numpad1",
        "command": "workbench.action.debug.stop",
        "when": "inDebugMode && !focusedSessionIsAttach"
    },
    {
        "key": "shift+f5",
        "command": "-workbench.action.debug.stop",
        "when": "inDebugMode && !focusedSessionIsAttach"
    },
    {
        "key": "ctrl+numpad6",
        "command": "workbench.action.debug.stepOver",
        "when": "debugState == 'stopped'"
    },
    {
        "key": "f10",
        "command": "-workbench.action.debug.stepOver",
        "when": "debugState == 'stopped'"
    },
    {
        "key": "ctrl+t",
        "command": "markdown-preview-enhanced.insertTable"
    },
    {
        "key": "ctrl+numpad4",
        "command": "workbench.action.debug.restart",
        "when": "inDebugMode"
    },
    {
        "key": "ctrl+shift+f5",
        "command": "-workbench.action.debug.restart",
        "when": "inDebugMode"
    },
    {
        "key": "ctrl+j oem_1",
        "command": "workbench.action.gotoLine"
    },
    {
        "key": "ctrl+g",
        "command": "-workbench.action.gotoLine"
    },
    {
        "key": "ctrl+j r",
        "command": "code-runner.run"
    },
    {
        "key": "ctrl+alt+n",
        "command": "-code-runner.run"
    },
    {
        "key": "ctrl+b l",
        "command": "bookmarks.listFromAllFiles"
    },
    {
        "key": "ctrl+j ctrl+f",
        "command": "workbench.view.search"
    },
    {
        "key": "ctrl+shift+f",
        "command": "-workbench.view.search",
        "when": "workbench.view.search.active && neverMatch =~ /doesNotMatch/"
    },
    {
        "key": "ctrl+j n",
        "command": "editor.action.marker.nextInFiles",
        "when": "editorFocus"
    },
    {
        "key": "f8",
        "command": "-editor.action.marker.nextInFiles",
        "when": "editorFocus"
    },
    {
        "key": "ctrl+j p",
        "command": "editor.action.peekDefinition",
        "when": "editorHasDefinitionProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor"
    },
    {
        "key": "alt+f12",
        "command": "-editor.action.peekDefinition",
        "when": "editorHasDefinitionProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor"
    },
    {
        "key": "ctrl+j oem_6",
        "command": "terminal.focus",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+j oem_6",
        "command": "workbench.action.focusActiveEditorGroup",
        "when": "terminalFocus"
    },
    {
        "key": "ctrl+numpad_add oem_6",
        "command": "editor.action.indentLines",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+oem_6",
        "command": "-editor.action.indentLines",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+numpad_add oem_4",
        "command": "editor.action.outdentLines",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+oem_4",
        "command": "-editor.action.outdentLines",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+numpad_add e",
        "command": "workbench.action.quickOpen"
    },
    {
        "key": "ctrl+e",
        "command": "-workbench.action.quickOpen"
    },
    // 下面是窗口快捷键
    {
        "key": "ctrl+e h",
        "command": "workbench.action.navigateLeft"
    },
    {
        "key": "ctrl+e l",
        "command": "workbench.action.navigateRight"
    },
    {
        "key": "ctrl+e k",
        "command": "workbench.action.navigateUp"
    },
    {
        "key": "ctrl+e j",
        "command": "workbench.action.navigateDown"
    },
    {
        "key": "ctrl+j ctrl+s",
        "command": "workbench.action.openGlobalKeybindingsFile"
    },
    {
        "key": "ctrl+j ctrl+o",
        "command": "revealFileInOS"
    },
    {
        "key": "shift+alt+r",
        "command": "-revealFileInOS",
        "when": "!editorFocus"
    },
    {
        "key": "ctrl+e n",
        "command": "workbench.action.navigateEditorGroups"
    },
    {
        "key": "ctrl+e oem_period",
        "command": "workbench.action.toggleEditorWidths"
    },
    {
        "key": "ctrl+[",
        "command":"workbench.action.navigateBack"
    },
    {
        "key": "ctrl+]",
        "command":"workbench.action.navigateForward",
    },
    {
        "key": "ctrl+t k",
        "command":"workbench.action.terminal.resizePaneUp"
    },
    {
        "key": "ctrl+t j",
        "command": "workbench.action.terminal.resizePaneDown"
    },
    {
        "key": "ctrl+t numpad4",
        "command":"workbench.action.terminal.focusPreviousPane",
    },
    {
        "key": "ctrl+t numpad6",
        "command":"workbench.action.terminal.focusNextPane",
    },
    {
        "key": "ctrl+t numpad8",
        "command": "workbench.action.toggleMaximizedPanel"
    },
    {
        "key": "ctrl+t h",
        "command": "workbench.action.terminal.resizePaneLeft"
    },
    {
        "key": "ctrl+t l",
        "command": "workbench.action.terminal.resizePaneRight"
    },
    {
        "key": "ctrl+t numpad5",
        "command": "workbench.action.terminal.split",
        "when": "terminalFocus && terminalProcessSupported || terminalFocus && terminalWebExtensionContributedProfile"
    },
    {
        "key": "ctrl+shift+5",
        "command": "-workbench.action.terminal.split",
        "when": "terminalFocus && terminalProcessSupported || terminalFocus && terminalWebExtensionContributedProfile"
    }
]
1
2
3
4
5
6
  {
   "workbench.colorCustomizations": {
        "titleBar.activeBackground": "#f498d1",
        "titleBar.activeForeground": "#ffffff"
    }
  }

vscode 终端美化

网站地址

自定义 tasks 命令

参考文章

运行 shell 命令

参考插件

配置 linux自定义脚本

1
2
3
4
5
6
"editWithShell.shell.windows": "wsl.exe",
    "editWithShell.shellArgs.windows": [
      
        "bash",
        "-c"
    ],

自定义 command命令

参考插件

vscode ctrl space 因为输入法而导致 键位不起作用解决方法

参考博客

windows 默认 ctrl+space 是切换中英文输入法,而且这个没办法改,要修改注册表

找到 HKEY_CURRENT_USER/Control Panel/Input Method/Hot Keys

其中00000070对应中文繁体热键,00000010是中文简体热键。

将 Key Modifiers的第一个字节从02改为00。将Virtual Key的第一个字节从20改为FF。

中英文标点输入问题

vscode 下 中文标点没法触发快捷键, 可以在 搜狗浏览器 设置 ctrl . 快捷键 切换中英文,但是字母的话也没法触发快捷键,最好还是切换为中文的时候再使用快捷键

输入法英文切换问题

idea 配置

参考博客

1
2
3
4
:set keep-english-in-normal #开启输入法自动切换功能
:set keep-english-in-normal-and-restore-in-insert #回到insert模式时恢复输入法
:set nokeep-english-in-normal-and-restore-in-insert #保留输入法自动切换功能,但是回到insert模式不恢复输入法
:set nokeep-english-in-normal #关闭输入法自动切换功能

安装 scoop

安装 scoop

安装im-select

1
2
3
 im-select 2057
PS D:\ASUS\Desktop> im-select 1033
PS D:\ASUS\Desktop> im-select 2052

这样就能通过命令切换输入法了

1
2
3
4
5
6
7
"vim.autoSwitchInputMethod.enable": true,
"vim.autoSwitchInputMethod.defaultIM": "1033",
"vim.autoSwitchInputMethod.obtainIMCmd": "D:\\PortableApp\\bin\\im-select.exe", 
"vim.autoSwitchInputMethod.switchIMCmd": "D:\\PortableApp\\bin\\im-select.exe {im}",

作者:silaoA
链接:https://www.zhihu.com/question/303850876/answer/2263584870

我自己的配置

1
2
3
4
"vim.autoSwitchInputMethod.enable": true,
    "vim.autoSwitchInputMethod.defaultIM": "1033",
    "vim.autoSwitchInputMethod.obtainIMCmd": "~\\scoop\\apps\\im-select\\current\\im-select.exe",
    "vim.autoSwitchInputMethod.switchIMCmd": "~\\scoop\\apps\\im-select\\current\\im-select.exe {im}",

创建软连接,

1
2
C:\Users\ASUS\scoop> mklink /j "apps" "D:\software8\region99\scoop\scoopDir\apps"
为 apps <<===>> D:\software8\region99\scoop\scoopDir\apps 创建的联接

idea vim 的配置

配置 vim插件

记住快捷键 + vim 的一些操作,可以根据方便快捷, 这里还可以配置一下 leader键 , 自定义较多的快捷键

Vim预置有很多快捷键,再加上各类插件的快捷键,大量快捷键出现在单层空间中难免引起冲突。为缓解该问题,而引入了前缀键。藉由前缀键, 则可以衍生出更多的快捷键命名空间(namespace)。例如将r键配置为r、r等多个快捷键。

leader键值自定义 键位总结

1
2
3
4
5
6
7
   
" leader+s => open shell 
noremap <leader>s :shell<CR>



 

学习教程

同步vimrc 配置

1
2
# 创建一个 backup.ps1 的脚本,在坚果云的文件夹下点击运行即可, 这样 就可以用坚果云同步了
cat ~/.vimrc >> ./.vimrc.bak

vim 宏录制学习

录制宏

使用方式

1
2
3
q + 寄存器名字 + operation + q 

@寄存器名字
1
2
3
4
;自动在每一行添加 # 

qa 0 i #  esc 0 j q
10 @a

自定义 vim快捷键

1
2
3
4
5
6
7
noremap <leader>s :shell<CR>
" noremap <leader>w :
noremap <leader>wh <C-W>h<CR>

noremap <leader>wl <C-W>l<CR>
noremap <leader>wj <C-W>j<CR>
noremap <leader>wk <C-W>k<CR>

解释;
leader s , 打开 shell
leader wl , 等于 ctrl + w l , 切换窗口,

vim-surround 使用

参考文章

1
2
cs"
ds"

vim其他快捷键创作

快捷跳转

1
2
3
`. => 跳转上次修改位置
ma => 标记 a标签,通过 ' 可以跳转回来
`a => 跳转a标签

命令

1
2
VU  全选一行,转大写 
q: 历史命令窗口

自定义vscode vim 配置

 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
{
 "vim.normalModeKeyBindingsNonRecursive": [
  // easy motion keys begin  
  // { "before": [ "<pageUp>" ], "after": [am","P", "<nop>" ], "silent": true },
  { "before": [ "o" ], "after": [ "m", "o", "o" ], "silent": true },
  { "before": [ "O" ], "after": [ "m", "O", "O" ], "silent": true },
  { "before": [ "A" ], "after": [ "m", "A", "A" ], "silent": true },
  { "before": [ "a" ], "after": [ "m", "a", "a" ], "silent": true },
  { "before": [ "R" ], "after": [ "m", "R", "R" ], "silent": true },
  { "before": [ "r" ], "after": [ "m", "r", "r" ], "silent": true },
  { "before": [ "i" ], "after": [ "m", "i", "i" ], "silent": true },
  { "before": [ "I" ], "after": [ "m", "I", "I" ], "silent": true },
  { "before": [ "<esc>" ], "after": [ "<esc>", "m", "c" ], "silent": true },
  { "before": [ "<enter>" ], "after": [ "m", "e", "<nop>" ], "silent": true },
  { "before": [ "<delete>" ], "after": [ "m", "E", "<nop>" ], "silent": true },
  { "before": [ "<BS>" ], "after": [ "m", "b", "<nop>" ], "silent": true },
  { "before": [ "<tab>","<tab>" ], "after": [ "m", "t", "<nop>" ] },
  // { "before": [ "'" ], "after": [ "m", "T", "'" ] },
  { "before": [ "*" ], "after": [ "m", "S", "*" ] },
  { "before": [ "g", "'" ], "after": [ ":", "r", "e", "g", "i", "s", "t", "e", "r", "<enter>" ] },
  { "before": [ "p" ], "after": [ "m", "p", "p" ] },
  { "before": [ "V" ], "after": [ "m", "v", "V" ] },
  { "before": [ "d", "d" ], "after": [ "m", "d", "d", "d" ] },
  { "before": [ "y", "y" ], "after": [ "y", "y", "m", "h" ] },
  { "before": [ "G" ], "after": [ "m", "G", "G" ] },
  // { "before": [ "`" ], "after": [ "m", "t", "`" ] },
  // { "before": [ "'" ], "after": [ "m", "T", "'" ] },
  { "before": [ "g", "q" ], "commands": [ "editor.action.autoFix" ] },
  { "before": [ "g", "Q" ], "commands": [ "editor.action.quickFix" ] },
  { "before": [ "g", "g" ], "after": [ "m", "g", "g", "g" ] },
  { "before": [ "g", "s" ], "after": [ "`" ] },
  { "before": [ "s" ], "after": [ "m", "s", "<leader>", "<leader>", "s" ] },
  { "before": [ "S" ], "after": [ "m", "s", "<leader>", "<leader>", "/" ] },
  { "before": [ "f" ], "after": [ "m", "f", "<leader>", "<leader>", "<leader>", "b", "d", "e" ] },
  { "before": [ "F" ], "after": [ "m", "f", "<leader>", "<leader>", "<leader>", "j" ] },
  { "before": [ "B" ], "after": [ "<leader>", "<leader>", "<leader>", "b", "d", "w" ] },
  { "before": [ "<leader>", "p" ], "commands": [ "workbench.action.pinEditor" ], },
  { "before": [ "<leader>", "P" ], "commands": [ "workbench.action.unpinEditor" ], },
  { "before": [ "<leader>", "j" ], "after": ["m","j","L","m","J"], },
  { "before": [ "<leader>", "k" ], "after": ["m","k","H","m","K"], },
  { "before": [ "<leader>", "/" ], "after": [ "<leader>", "<leader>", "/" ], },
  { "before": [ "g", "p" ], "commands": [
    "whichkey.show",
    {
     "command": "whichkey.triggerKey",
     "args": "G"
    }
   ] },
  { "before": [ "g", "x" ], "commands": [
    "whichkey.show",
    {
     "command": "whichkey.triggerKey",
     "args": "X"
    }
   ]
  },
}