个人Vscode配置

VScode配置

配置neovim

步骤

  1. 安装neovim

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

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

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

    # 我这里的~路径为C:\Users\moon,用win+r打开cmd默认打开路径就是~
    cd AppData/Local/nvim
    
    # 没有就在AppData/Local/下创建一个
    mkdir nvim
    
    # 查看是否有init.vim,没有创建一个
    touch init.vim
    
  5. 使用nvim进入init.vim,复制以下内容:

    " 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. 安装好后进行配置插件

    # 插件链表
    - 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(可查看代码编写人,用于团队开发)
    - Git History(可查看git历史记录)
    - One Dark Pro(好看的主题)
    - Bearded Icons(丰富的文件夹图标)
    - Doxygen Documentation Generator(用于写函数注释的插件)
    - TONGYI Lingma(辅助编码ai)
    - GBK to UTF8 for vscode(支持utf8跟gbk相互转换)
    - GitHub Repositories(可以直接预览github仓库代码)
    - Remote-SSH(ssh连接插件)
    - CodeSnap(一个用于生成好看的代码截图插件)
    
  3. 打开VScode的用户的settings.json,将以下内容复制到你的settings.json

    {
      "cmake.pinnedCommands": [
        "workbench.action.tasks.configureTaskRunner",
        "workbench.action.tasks.runTask"
      ],
      "cmake.generator": "MinGW Makefiles",
      "vscode-neovim.neovimExecutablePaths.win32": "C:\\Neovim\\bin\\nvim.exe",
      "vscode-neovim.neovimInitVimPaths.win32": "C:\\Users\\moon\\AppData\\Local\\nvim\\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.formatOnSave": true,
      "editor.formatOnType": false,
      "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",
      "cmake.showOptionsMovedNotification": false,
      "editor.minimap.enabled": false,
      "workbench.iconTheme": "bearded-icons",
      "editor.quickSuggestionsDelay": 0,
      // 设置cpp代码风格
      "C_Cpp.clang_format_style": "{ SortIncludes: false,BasedOnStyle: Google, UseTab: Never, IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Attach, ColumnLimit: 80, AccessModifierOffset: -4 }",
    }
    
  4. 打开VScode的keybindings.json,将以下内容复制替换

    // 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. cpp代码风格设置.clang-format文件内容(已经在vscode中设置好了无需.clang-format文件,以下适用于我在linux下用vim写项目统一所有代码风格)

    SortIncludes: false
    BasedOnStyle: Google
    UseTab: Never
    IndentWidth: 4
    TabWidth: 4
    BreakBeforeBraces: Attach
    ColumnLimit: 80
    AccessModifierOffset: -4 
    NamespaceIndentation: All
    # 设置谷歌代码风格,4个空格的缩进、左括号不换行、列数超过80格式化时会自动换行、public等访问权限修饰符缩进偏移以及命名空间内部缩进等
    
  6. 然后保存全部重启即可

常用键位映射

键位作用
ww保存当前文件
wq保存当前文件并退出
shift+enterjumpy2移动作用
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就可以看到更多的快捷键选项,剩下的自己探索

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Moon2144

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值