VScode配置

VScode配置

配置neovim

步骤

  1. 安装neovim

  2. 选择安装地址为C:\Neovim

  3. 在终端中输入以下命令查看是否安装成功

    1
    2
    3
    4
    5
    6
    nvim -version
    # 以下是输出
    NVIM v0.10.2
    Build type: Release
    LuaJIT 2.1.1713484068
    Run "nvim -V1 -v" for more info
  4. 进入到~\AppData\Local\nvim目录下

    1
    2
    3
    4
    5
    6
    7
    8
    # 我这里的~路径为C:\Users\moon,用win+r打开cmd默认打开路径就是~
    cd AppData/Local/nvim

    # 没有就在AppData/Local/下创建一个
    mkdir nvim

    # 查看是否有init.vim,没有创建一个
    touch init.vim
  5. 使用nvim进入init.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
    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
    " TODO there is a more contemporary version of this file
    "VSCode
    function! s:split(...) abort
    let direction = a:1
    let file = a:2
    call VSCodeCall(direction == 'h' ? 'workbench.action.splitEditorDown' : 'workbench.action.splitEditorRight')
    if file != ''
    call VSCodeExtensionNotify('open-file', expand(file), 'all')
    endif
    endfunction

    function! s:splitNew(...)
    let file = a:2
    call s:split(a:1, file == '' ? '__vscode_new__' : file)
    endfunction

    function! s:closeOtherEditors()
    call VSCodeNotify('workbench.action.closeEditorsInOtherGroups')
    call VSCodeNotify('workbench.action.closeOtherEditors')
    endfunction

    function! s:manageEditorSize(...)
    let count = a:1
    let to = a:2
    for i in range(1, count ? count : 1)
    call VSCodeNotify(to == 'increase' ? 'workbench.action.increaseViewSize' : 'workbench.action.decreaseViewSize')
    endfor
    endfunction

    command! -complete=file -nargs=? Split call <SID>split('h', <q-args>)
    command! -complete=file -nargs=? Vsplit call <SID>split('v', <q-args>)
    command! -complete=file -nargs=? New call <SID>split('h', '__vscode_new__')
    command! -complete=file -nargs=? Vnew call <SID>split('v', '__vscode_new__')
    command! -bang Only if <q-bang> == '!' | call <SID>closeOtherEditors() | else | call VSCodeNotify('workbench.action.joinAllGroups') | endif

    nnoremap <silent> <C-w>s :call <SID>split('h')<CR>
    xnoremap <silent> <C-w>s :call <SID>split('h')<CR>

    nnoremap <silent> <C-w>v :call <SID>split('v')<CR>
    xnoremap <silent> <C-w>v :call <SID>split('v')<CR>

    nnoremap <silent> <C-w>n :call <SID>splitNew('h', '__vscode_new__')<CR>
    xnoremap <silent> <C-w>n :call <SID>splitNew('h', '__vscode_new__')<CR>


    nnoremap <silent> <C-w>= :<C-u>call VSCodeNotify('workbench.action.evenEditorWidths')<CR>
    xnoremap <silent> <C-w>= :<C-u>call VSCodeNotify('workbench.action.evenEditorWidths')<CR>

    nnoremap <silent> <C-w>> :<C-u>call <SID>manageEditorSize(v:count, 'increase')<CR>
    xnoremap <silent> <C-w>> :<C-u>call <SID>manageEditorSize(v:count, 'increase')<CR>
    nnoremap <silent> <C-w>+ :<C-u>call <SID>manageEditorSize(v:count, 'increase')<CR>
    xnoremap <silent> <C-w>+ :<C-u>call <SID>manageEditorSize(v:count, 'increase')<CR>
    nnoremap <silent> <C-w>< :<C-u>call <SID>manageEditorSize(v:count, 'decrease')<CR>
    xnoremap <silent> <C-w>< :<C-u>call <SID>manageEditorSize(v:count, 'decrease')<CR>
    nnoremap <silent> <C-w>- :<C-u>call <SID>manageEditorSize(v:count, 'decrease')<CR>
    xnoremap <silent> <C-w>- :<C-u>call <SID>manageEditorSize(v:count, 'decrease')<CR>

    " Better Navigation
    nnoremap <silent> <C-j> :call VSCodeNotify('workbench.action.navigateDown')<CR>
    xnoremap <silent> <C-j> :call VSCodeNotify('workbench.action.navigateDown')<CR>
    nnoremap <silent> <C-k> :call VSCodeNotify('workbench.action.navigateUp')<CR>
    xnoremap <silent> <C-k> :call VSCodeNotify('workbench.action.navigateUp')<CR>
    nnoremap <silent> <C-h> :call VSCodeNotify('workbench.action.navigateLeft')<CR>
    xnoremap <silent> <C-h> :call VSCodeNotify('workbench.action.navigateLeft')<CR>
    nnoremap <silent> <C-l> :call VSCodeNotify('workbench.action.navigateRight')<CR>
    xnoremap <silent> <C-l> :call VSCodeNotify('workbench.action.navigateRight')<CR>

    " 自定义函数:调用 VSCode 的注释命令
    function! Comment()
    " 调用 VSCode 的注释行命令
    call VSCodeNotify('editor.action.commentLine')
    endfunction

    " Bind C-/ to vscode commentary since calling from vscode produces double comments due to multiple cursors
    xnoremap <silent> <C-_> :call Comment()<CR>
    nnoremap <silent> <C-_> :call Comment()<CR>
    vnoremap <silent> <C-_> :call Comment()<CR>

    nnoremap <silent> <C-w>_ :<C-u>call VSCodeNotify('workbench.action.toggleEditorWidths')<CR>

    nnoremap <silent> <Space> :call VSCodeNotify('whichkey.show')<CR>
    xnoremap <silent> <Space> :call VSCodeNotify('whichkey.show')<CR>

    " 普通模式下 Ctrl+A 全选
    nnoremap <C-a> ggVG

    " 插入模式下 Ctrl+A 全选
    inoremap <C-a> <Esc>ggVG
    " 使用系统剪贴板
    set clipboard=unnamedplus

    " 自定义函数:保存所有文件并关闭当前编辑器
    function! SaveAllAndClose()
    wa!
    call VSCodeNotify('workbench.action.closeActiveEditor')
    endfunction

    " 自定义函数:强制关闭当前编辑器(不保存)
    function! ForceClose()
    call VSCodeNotify('workbench.action.closeActiveEditor')
    endfunction

    " 自定义函数:纵向分割窗口
    function! SplitVertical()
    call VSCodeNotify('workbench.action.splitEditorRight')
    endfunction

    " 自定义函数:横向分割窗口
    function! SplitHorizontal()
    call VSCodeNotify('workbench.action.splitEditorDown')
    endfunction

    " 自定义函数:横向分割窗口
    function! SplitHorizontal()
    call VSCodeNotify('workbench.action.splitEditorDown')
    endfunction

    " 将 'ww' 映射为保存所有文件
    nnoremap ww :wa!<CR>

    " 将 'wq' 映射为保存所有文件并关闭当前编辑器
    nnoremap wq :call SaveAllAndClose()<CR>

    " 将 'qq' 映射为强制关闭当前编辑器(不保存)
    nnoremap qq :call ForceClose()<CR>

    " 将 'vs' 映射为纵向分割窗口
    nnoremap vs :call SplitVertical()<CR>

    " 将 'hs' 映射为横向分割窗口
    nnoremap hs :call SplitHorizontal()<CR>


    set shiftwidth=4 " 每次缩进4个空格
    set tabstop=4 " Tab 键等同于4个空格
    set expandtab " 将 Tab 转换为空格
    " 在 Normal 模式下,Tab 键向右缩进当前行
    nnoremap <Tab> >>

    " 在 Normal 模式下,Shift+Tab 键向左缩进当前行
    nnoremap <S-Tab> <<

    " 在 Visual 模式下,Tab 键向右缩进选中的行
    vnoremap <Tab> >gv

    " 在 Visual 模式下,Shift+Tab 键向左缩进选中的行
    vnoremap <S-Tab> <gv


    " 设置复制高亮
    augroup YankHighlight
    autocmd!
    autocmd TextYankPost * silent! lua vim.highlight.on_yank {on_visual=true}
    augroup END

vscode配置

步骤

  1. 安装个[vscode](Download Visual Studio Code - Mac, Linux, Windows)

  2. 安装好后进行配置插件

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    # 插件链表
    - Chinese(中文插件)
    - C/C++(C++程序需要的)
    - C/C++ Extension Pack
    - C/C++ Themes
    - Go(golang开发需要)
    - CMake
    - CMake ToolS
    - CMake Language Support
    - VScode Neovim(用于neovim)
    - Which Key(用于查看映射键)
    - Jumpy2(用来移动跳转插件)
    - Git Graph(可视化git操作)
    - GitLens(可查看代码编写人,用于团队开发)
    - Prettier - Code formatter(用于格式化代码)
    - One Dark Pro(好看的主题)
    - Material Icon Theme(丰富的文件夹图标)
    - Doxygen Documentation Generator(用于写函数注释的插件)
    - GBK to UTF8 for vscode(支持utf8跟gbk相互转换)
    - GitHub Repositories(可以直接预览github仓库代码)
    - Remote-SSH(ssh连接插件)
    - CodeSnap(一个用于生成好看的代码截图插件)
  3. 打开VScode的用户的settings.json,将以下内容复制到你的settings.json

    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
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    {
    "cmake.pinnedCommands": [
    "workbench.action.tasks.configureTaskRunner",
    "workbench.action.tasks.runTask"
    ],
    "cmake.generator": "MinGW Makefiles",
    "vscode-neovim.neovimExecutablePaths.win32": "C:\\Neovim\\bin\\nvim.exe", // 你nvim.exe的路径
    "vscode-neovim.neovimInitVimPaths.win32": "C:\\Users\\moon\\AppData\\Local\\nvim\\init.vim", //你init.vim的路径
    "whichkey.sortOrder": "alphabetically",
    "vscode-neovim.useCtrlKeys": true,
    "whichkey.bindings": [
    {
    "key": ";",
    "name": "commands",
    "type": "command",
    "command": "workbench.action.showCommands"
    },
    {
    "key": "b",
    "name": "Buffers/Editors...",
    "type": "bindings",
    "bindings": [
    {
    "key": "b",
    "name": "Show all buffers/editors",
    "type": "command",
    "command": "workbench.action.showAllEditors"
    },
    {
    "key": "d",
    "name": "Close active editor",
    "type": "command",
    "command": "workbench.action.closeActiveEditor"
    },
    {
    "key": "h",
    "name": "Move editor into left group",
    "type": "command",
    "command": "workbench.action.moveEditorToLeftGroup"
    },
    {
    "key": "j",
    "name": "Move editor into below group",
    "type": "command",
    "command": "workbench.action.moveEditorToBelowGroup"
    },
    {
    "key": "k",
    "name": "Move editor into above group",
    "type": "command",
    "command": "workbench.action.moveEditorToAboveGroup"
    },
    {
    "key": "l",
    "name": "Move editor into right group",
    "type": "command",
    "command": "workbench.action.moveEditorToRightGroup"
    },
    {
    "key": "m",
    "name": "Close other editors",
    "type": "command",
    "command": "workbench.action.closeOtherEditors"
    },
    {
    "key": "N",
    "name": "New untitled editor",
    "type": "command",
    "command": "workbench.action.files.newUntitledFile"
    },
    {
    "key": "u",
    "name": "Reopen closed editor",
    "type": "command",
    "command": "workbench.action.reopenClosedEditor"
    },
    {
    "key": "y",
    "name": "Copy buffer to clipboard",
    "type": "commands",
    "commands": [
    "editor.action.selectAll",
    "editor.action.clipboardCopyAction",
    "cancelSelection"
    ]
    }
    ]
    },
    {
    "key": "d",
    "name": "Debug...",
    "type": "bindings",
    "bindings": [
    {
    "key": "d",
    "name": "Start debug",
    "type": "command",
    "command": "workbench.action.debug.start"
    },
    {
    "key": "S",
    "name": "Stop debug",
    "type": "command",
    "command": "workbench.action.debug.stop"
    },
    {
    "key": "c",
    "name": "Continue debug",
    "type": "command",
    "command": "workbench.action.debug.continue"
    },
    {
    "key": "p",
    "name": "Pause debug",
    "type": "command",
    "command": "workbench.action.debug.pause"
    },
    {
    "key": "r",
    "name": "Run without debugging",
    "type": "command",
    "command": "workbench.action.debug.run"
    },
    {
    "key": "R",
    "name": "Restart debug",
    "type": "command",
    "command": "workbench.action.debug.restart"
    },
    {
    "key": "i",
    "name": "Step into",
    "type": "command",
    "command": "workbench.action.debug.stepInto"
    },
    {
    "key": "s",
    "name": "Step over",
    "type": "command",
    "command": "workbench.action.debug.stepOver"
    },
    {
    "key": "o",
    "name": "Step out",
    "type": "command",
    "command": "workbench.action.debug.stepOut"
    },
    {
    "key": "b",
    "name": "Toggle breakpoint",
    "type": "command",
    "command": "editor.debug.action.toggleBreakpoint"
    },
    {
    "key": "B",
    "name": "Toggle inline breakpoint",
    "type": "command",
    "command": "editor.debug.action.toggleInlineBreakpoint"
    },
    {
    "key": "j",
    "name": "Jump to cursor",
    "type": "command",
    "command": "debug.jumpToCursor"
    },
    {
    "key": "v",
    "name": "REPL",
    "type": "command",
    "command": "workbench.debug.action.toggleRepl"
    },
    {
    "key": "w",
    "name": "Focus on watch window",
    "type": "command",
    "command": "workbench.debug.action.focusWatchView"
    },
    {
    "key": "W",
    "name": "Add to watch",
    "type": "command",
    "command": "editor.debug.action.selectionToWatch"
    }
    ]
    },
    {
    "key": "e",
    "name": "Toggle Explorer",
    "type": "command",
    "command": "workbench.action.toggleSidebarVisibility"
    },
    {
    "key": "f",
    "name": "Find & Replace...",
    "type": "bindings",
    "bindings": [
    {
    "key": "f",
    "name": "File",
    "type": "command",
    "command": "editor.action.startFindReplaceAction"
    },
    {
    "key": "s",
    "name": "Symbol",
    "type": "command",
    "command": "editor.action.rename",
    "when": "editorHasRenameProvider && editorTextFocus && !editorReadonly"
    },
    {
    "key": "p",
    "name": "Project",
    "type": "command",
    "command": "workbench.action.replaceInFiles"
    }
    ]
    },
    {
    "key": "g",
    "name": "Git...",
    "type": "bindings",
    "bindings": [
    {
    "key": "b",
    "name": "Checkout",
    "type": "command",
    "command": "git.checkout"
    },
    {
    "key": "c",
    "name": "Commit",
    "type": "command",
    "command": "git.commit"
    },
    {
    "key": "d",
    "name": "Delete Branch",
    "type": "command",
    "command": "git.deleteBranch"
    },
    {
    "key": "f",
    "name": "Fetch",
    "type": "command",
    "command": "git.fetch"
    },
    {
    "key": "i",
    "name": "Init",
    "type": "command",
    "command": "git.init"
    },
    {
    "key": "m",
    "name": "Merge",
    "type": "command",
    "command": "git.merge"
    },
    {
    "key": "p",
    "name": "Publish",
    "type": "command",
    "command": "git.publish"
    },
    {
    "key": "s",
    "name": "Stash",
    "type": "command",
    "command": "workbench.view.scm"
    },
    {
    "key": "S",
    "name": "Stage",
    "type": "command",
    "command": "git.stage"
    },
    {
    "key": "U",
    "name": "Unstage",
    "type": "command",
    "command": "git.unstage"
    }
    ]
    },
    {
    "key": "l",
    "name": "Next editor",
    "type": "command",
    "command": "workbench.action.nextEditor"
    },
    {
    "key": "h",
    "name": "Previous editor",
    "type": "command",
    "command": "workbench.action.previousEditor"
    },
    {
    "key": "i",
    "name": "Insert...",
    "type": "bindings",
    "bindings": [
    {
    "key": "j",
    "name": "Insert line below",
    "type": "command",
    "command": "editor.action.insertLineAfter"
    },
    {
    "key": "k",
    "name": "Insert line above",
    "type": "command",
    "command": "editor.action.insertLineBefore"
    },
    {
    "key": "s",
    "name": "Insert snippet",
    "type": "command",
    "command": "editor.action.insertSnippet"
    }
    ]
    },
    {
    "key": "m",
    "name": "minimap",
    "type": "command",
    "command": "editor.action.toggleMinimap"
    },
    {
    "key": "n",
    "name": "highlight",
    "type": "command",
    "command": "vscode-neovim.send",
    "args": ":noh<CR>"
    },
    {
    "key": "s",
    "name": "Search...",
    "type": "bindings",
    "bindings": [
    {
    "key": "f",
    "name": "files",
    "type": "command",
    "command": "workbench.action.quickOpen"
    },
    {
    "key": "t",
    "name": "text",
    "type": "command",
    "command": "workbench.action.findInFiles"
    }
    ]
    },
    {
    "key": "S",
    "name": "Show...",
    "type": "bindings",
    "bindings": [
    {
    "key": "e",
    "name": "Show explorer",
    "type": "command",
    "command": "workbench.view.explorer"
    },
    {
    "key": "s",
    "name": "Show search",
    "type": "command",
    "command": "workbench.view.search"
    },
    {
    "key": "g",
    "name": "Show source control",
    "type": "command",
    "command": "workbench.view.scm"
    },
    {
    "key": "t",
    "name": "Show test",
    "type": "command",
    "command": "workbench.view.extension.test"
    },
    {
    "key": "r",
    "name": "Show remote explorer",
    "type": "command",
    "command": "workbench.view.remote"
    },
    {
    "key": "x",
    "name": "Show extensions",
    "type": "command",
    "command": "workbench.view.extensions"
    },
    {
    "key": "p",
    "name": "Show problem",
    "type": "command",
    "command": "workbench.actions.view.problems"
    },
    {
    "key": "o",
    "name": "Show output",
    "type": "command",
    "command": "workbench.action.output.toggleOutput"
    },
    {
    "key": "d",
    "name": "Show debug console",
    "type": "command",
    "command": "workbench.debug.action.toggleRepl"
    }
    ]
    },
    {
    "key": "t",
    "name": "Terminal...",
    "type": "bindings",
    "bindings": [
    {
    "key": "t",
    "name": "Toggle Terminal",
    "type": "command",
    "command": "workbench.action.togglePanel"
    }
    ]
    },
    {
    "key": "T",
    "name": "UI toggles...",
    "type": "bindings",
    "bindings": [
    {
    "key": "b",
    "name": "Toggle side bar visibility",
    "type": "command",
    "command": "workbench.action.toggleSidebarVisibility"
    },
    {
    "key": "j",
    "name": "Toggle panel visibility",
    "type": "command",
    "command": "workbench.action.togglePanel"
    },
    {
    "key": "F",
    "name": "Toggle full screen",
    "type": "command",
    "command": "workbench.action.toggleFullScreen"
    },
    {
    "key": "s",
    "name": "Select theme",
    "type": "command",
    "command": "workbench.action.selectTheme"
    },
    {
    "key": "m",
    "name": "Toggle maximized panel",
    "type": "command",
    "command": "workbench.action.toggleMaximizedPanel"
    },
    {
    "key": "t",
    "name": "Toggle tool/activity bar visibility",
    "type": "command",
    "command": "workbench.action.toggleActivityBarVisibility"
    },
    {
    "key": "T",
    "name": "Toggle tab visibility",
    "type": "command",
    "command": "workbench.action.toggleTabsVisibility"
    }
    ]
    },
    {
    "key": "w",
    "name": "Window...",
    "type": "bindings",
    "bindings": [
    {
    "key": "W",
    "name": "Focus previous editor group",
    "type": "command",
    "command": "workbench.action.focusPreviousGroup"
    },
    {
    "key": "h",
    "name": "Move editor group left",
    "type": "command",
    "command": "workbench.action.moveActiveEditorGroupLeft"
    },
    {
    "key": "j",
    "name": "Move editor group down",
    "type": "command",
    "command": "workbench.action.moveActiveEditorGroupDown"
    },
    {
    "key": "k",
    "name": "Move editor group up",
    "type": "command",
    "command": "workbench.action.moveActiveEditorGroupUp"
    },
    {
    "key": "l",
    "name": "Move editor group right",
    "type": "command",
    "command": "workbench.action.moveActiveEditorGroupRight"
    },
    {
    "key": "t",
    "name": "Toggle editor group sizes",
    "type": "command",
    "command": "workbench.action.toggleEditorWidths"
    },
    {
    "key": "m",
    "name": "Maximize editor group",
    "type": "command",
    "command": "workbench.action.minimizeOtherEditors"
    },
    {
    "key": "M",
    "name": "Maximize editor group and hide side bar",
    "type": "command",
    "command": "workbench.action.maximizeEditor"
    },
    {
    "key": "=",
    "name": "Reset editor group sizes",
    "type": "command",
    "command": "workbench.action.evenEditorWidths"
    },
    {
    "key": "z",
    "name": "Combine all editors",
    "type": "command",
    "command": "workbench.action.joinAllGroups"
    },
    {
    "key": "d",
    "name": "Close editor group",
    "type": "command",
    "command": "workbench.action.closeEditorsInGroup"
    },
    {
    "key": "x",
    "name": "Close all editor groups",
    "type": "command",
    "command": "workbench.action.closeAllGroups"
    }
    ]
    },
    {
    "key": "z",
    "name": "Toggle zen mode",
    "type": "command",
    "command": "workbench.action.toggleZenMode"
    },
    ],
    // "files.autoSave": "afterDelay",
    "files.autoGuessEncoding": true,
    "workbench.list.smoothScrolling": true,
    "editor.cursorSmoothCaretAnimation": "on",
    "editor.smoothScrolling": true,
    "editor.cursorBlinking": "smooth",
    "editor.mouseWheelZoom": true,
    "editor.formatOnPaste": true,
    "editor.formatOnType": true,
    "editor.formatOnSave": true,
    "editor.wordWrap": "on",
    // "editor.guides.bracketPairs": true,
    "editor.bracketPairColorization.enabled": true,
    "editor.suggest.snippetsPreventQuickSuggestions": false,
    "editor.acceptSuggestionOnEnter": "smart",
    "editor.suggestSelection": "recentlyUsed",
    "window.dialogStyle": "custom",
    "debug.showBreakpointsInOverviewRuler": true,
    "editor.tokenColorCustomizations": {
    "[One Dark Pro]": {
    "textMateRules": [
    {
    "scope": [
    "support.class.component.open.jsx",
    "support.class.component.close.jsx",
    "entity.name.function.js"
    ],
    "settings": {
    "foreground": "#61afef"
    }
    },
    {
    "scope": [
    "variable.other.constant.object.js",
    "punctuation.section.embedded.begin.jsx",
    "punctuation.section.embedded.end.jsx"
    ],
    "settings": {
    "foreground": "#abb2bf"
    }
    },
    {
    "scope": [
    "punctuation.definition.tag.jsx"
    ],
    "settings": {
    "foreground": "#5c6370"
    }
    },
    {
    "scope": [
    "variable.other.readwrite.js",
    "variable.other.property.js",
    "variable.parameter",
    "variable.other.object.js"
    ],
    "settings": {
    "foreground": "#56b6c2"
    }
    },
    {
    "scope": [
    "entity.other.attribute-name.jsx"
    ],
    "settings": {
    "foreground": "#e5c07b"
    }
    },
    {
    "scope": [
    "keyword.operator.assignment.js",
    "keyword.operator.assignment.jsx",
    "string.unquoted.js",
    "keyword.operator.typeof.js",
    "meta.embedded.expression.js",
    "constant.other.object.key.js",
    "keyword.operator.logical.js"
    ],
    "settings": {
    "foreground": "#c678dd"
    }
    },
    {
    "scope": [
    "variable.other.constant.object.js"
    ],
    "settings": {
    "foreground": "#e06c75"
    }
    }
    ]
    }
    },
    "workbench.colorCustomizations": {
    "[Default Dark+]": {
    "statusBar.background": "#2E2E2E",
    "statusBar.foreground": "#569CD6",
    "statusBarItem.remoteBackground": "#2E2E2E",
    "statusBarItem.remoteForeground": "#569CD6",
    "activityBar.background": "#2E2E2E",
    "tab.inactiveBackground": "#2E2E2E"
    },
    "[One Dark Pro]": {
    "editor.background": "#1e2127",
    "terminal.foreground": "#abb2bf",
    "terminal.ansiBlack": "#1e2127",
    "terminal.ansiBlue": "#61afef",
    "terminal.ansiCyan": "#56b6c2",
    "terminal.ansiGreen": "#98C379",
    "terminal.ansiMagenta": "#c678dd",
    "terminal.ansiRed": "#e06c75",
    "terminal.ansiWhite": "#abb2bf",
    "terminal.ansiYellow": "#d19a66",
    "terminal.ansiBrightBlack": "#5c6370",
    "terminal.ansiBrightBlue": "#61afef",
    "terminal.ansiBrightCyan": "#56b6c2",
    "terminal.ansiBrightGreen": "#98c379",
    "terminal.ansiBrightMagenta": "#c678dd",
    "terminal.ansiBrightRed": "#e06c75",
    "terminal.ansiBrightWhite": "#ffffff",
    "terminal.ansiBrightYellow": "#d19a66",
    },
    "jumpy2.beaconColor": "#1abc9c80",
    "jumpy2.labelFontColor": "#05c5b9",
    "jumpy2.labelBackgroundColor": "#2c3e50",
    "jumpy2.labelBorderColor": "#2c3e50",
    "jumpy2.checkered_labelFontColor": "#05c5b9",
    "jumpy2.checkered_labelBackgroundColor": "#34495e",
    "jumpy2.checkered_labelBorderColor": "#2c3e50"
    },
    "workbench.colorTheme": "One Dark Pro",
    "workbench.iconTheme": "material-icon-theme",
    "cmake.showOptionsMovedNotification": false,
    "editor.minimap.enabled": false,
    }
  4. 打开VScode的keybindings.json,将以下内容复制替换

    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
    // Place your key bindings in this file to override the defaultsauto[]
    [
    {
    "key": "shift+ctrl+e",
    "command": "actions.findWithSelection"
    },
    {
    "key": "ctrl+e",
    "command": "-actions.findWithSelection"
    },
    {
    "key": "ctrl+e",
    "command": "workbench.view.explorer"
    },
    {
    "key": "shift+ctrl+e",
    "command": "-workbench.view.explorer"
    },
    {
    "key": "r",
    "command": "renameFile",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
    },
    {
    "key": "enter",
    "command": "-renameFile",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
    },
    {
    "key": "j",
    "command": "list.focusDown",
    "when": "listFocus && explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
    },
    {
    "key": "k",
    "command": "list.focusUp",
    "when": "listFocus && explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
    },
    {
    "key": "ctrl+j",
    "command": "selectNextSuggestion",
    "when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
    },
    {
    "key": "ctrl+k",
    "command": "selectPrevSuggestion",
    "when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
    },
    {
    "key": "ctrl+j",
    "command": "workbench.action.quickOpenNavigateNext",
    "when": "inQuickOpen"
    },
    {
    "key": "tab",
    "command": "selectNextSuggestion",
    "when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
    },
    {
    "key": "tab",
    "command": "workbench.action.quickOpenNavigateNext",
    "when": "inQuickOpen"
    },
    {
    "key": "shit+tab",
    "command": "selectPrevSuggestion",
    "when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
    },
    {
    "key": "shift+tab",
    "command": "selectPrevSuggestion",
    "when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
    },
    {
    "key": "shift+tab",
    "command": "workbench.action.quickOpenNavigatePrevious",
    "when": "inQuickOpen"
    },
    {
    "key": "ctrl+k",
    "command": "workbench.action.quickOpenNavigatePrevious",
    "when": "inQuickOpen"
    },
    {
    "key": "enter",
    "command": "list.select",
    "when": "explorerViewletVisible && filesExplorerFocus"
    },
    {
    "key": "l",
    "command": "list.select",
    "when": "explorerViewletVisible && filesExplorerFocus && !inputFocus"
    },
    {
    "key": "o",
    "command": "list.toggleExpand",
    "when": "explorerViewletVisible && filesExplorerFocus && !inputFocus"
    },
    {
    "key": "h",
    "command": "list.collapse",
    "when": "explorerViewletVisible && filesExplorerFocus && !inputFocus"
    },
    {
    "key": "a",
    "command": "explorer.newFile",
    "when": "filesExplorerFocus && !inputFocus"
    },
    {
    "key": "shift+a",
    "command": "explorer.newFolder",
    "when": "filesExplorerFocus && !inputFocus"
    },
    {
    "key": "shift+;",
    "command": "insertPrevSuggestion",
    "when": "hasOtherSuggestions && textInputFocus && textInputFocus && !inSnippetMode && !suggestWidgetVisible && config.editor.tabCompletion == 'on'"
    },
    {
    "key": "ctrl+l",
    "when": "sideBarFocus",
    "command": "workbench.action.focusActiveEditorGroup"
    },
    {
    "key": "ctrl+k",
    "command": "workbench.action.focusActiveEditorGroup",
    "when": "terminalFocus"
    },
    {
    "key": "ctrl+shift+t",
    "command": "workbench.action.terminal.focus",
    "when": "!terminalFocus"
    },
    {
    "key": "ctrl+j",
    "command": "-editor.action.insertLineAfter",
    "when": "editorTextFocus && neovim.ctrlKeysInsert && !neovim.recording && neovim.mode == 'insert'"
    },
    {
    "key": "alt+j",
    "command": "workbench.action.terminal.focus",
    "when": "!terminalFocus"
    },
    {
    "key": "ctrl+shift+t",
    "command": "workbench.action.togglePanel"
    },
    {
    "key": "ctrl+j",
    "command": "-workbench.action.togglePanel"
    },
    {
    "key": "shift+k",
    "command": "editor.action.showHover",
    "when": "editorTextFocus"
    },
    {
    "key": "ctrl+k ctrl+i",
    "command": "-editor.action.showHover",
    "when": "editorTextFocus"
    },
    {
    "key": "shift+tab",
    "command": "-acceptAlternativeSelectedSuggestion",
    "when": "suggestWidgetVisible && textInputFocus && textInputFocus"
    },
    {
    "key": "ctrl+f",
    "command": "-vscode-neovim.ctrl-f",
    "when": "editorTextFocus && neovim.ctrlKeysNormal && neovim.init && neovim.mode != 'insert'"
    },
    ]
  5. 然后保存全部重启即可

常用键位映射

键位 作用
ww 保存当前文件
wq 保存当前文件并退出
shift+enter jumpy2移动作用
ctrl+h 光标移动到左边一个窗口组
ctrl+l 光标移动到右边一个窗口组
ctrl+j 光标移动到下面一个窗口组
ctrl+k 光标移动到上面一个窗口组
space+e 打开/关闭文件树
space+f+f 查找当前文件单词匹配
space+s+f 全局查找文件
space+s+t 全局匹配文本
space+b+b 选择当前可跳转文件窗口(当前已经打开的文件)
space+b+d 关闭当前窗口
space+d+b 进行打断点
space+h 向前跳转一个窗口
space+l 向后跳转一个窗口

注意:输入space就可以看到更多的快捷键选项,剩下的自己探索


VScode配置
https://moonfordream.github.io/posts/VScode配置/
作者
Moon
发布于
2024年11月14日
许可协议