跳到正文

个人记录

VSCode / Cursor 配置脚本

Segment_Bugcat约 6 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 6 分钟

版本

  1. v1当前

.\.vscode\launch.json

JSON
{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "Debug C++",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}\\main.exe",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": true,
        "MIMode": "gdb",
        "miDebuggerPath": "E:\\MSYS2\\mingw64\\bin\\gdb.exe",
        "setupCommands": [
          {
            "description": "Enable pretty-printing",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
          }
        ]
      }
    ]
}

.\.vscode\task.json

JSON
{
    "version": "2.0.0",
    "tasks": [
      {
        "label": "Build C++",
        "type": "shell",
        "command": "g++",
        "args": [
          "-g",
          "${file}",
          "-o",
          "${workspaceFolder}\\main.exe"
        ],
        "group": {
          "kind": "build",
          "isDefault": true
        },
        "problemMatcher": ["$gcc"]
      }
    ]
}

.\.vscode\settings.json

JSON
// settings.json
{
    "[json]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
    "[jsonc]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
    "[markdown]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
    "C_Cpp.autoAddFileAssociations": false,
    "code-runner.executorMap": {
        "cpp": "g++ $fileName -o $fileNameWithoutExt -std=c++23 -Wall -Wextra -O2 -march=native && ./$fileNameWithoutExt"
    },
    "code-runner.fileDirectoryAsCwd": true,
    "code-runner.ignoreSelection": true,
    "code-runner.runInTerminal": true,
    "cph.general.autoShowJudge": false,
    "cph.language.cpp.Args": "-std=c++23 -Wall -Wextra -O2 -march=native",
    "editor.cursorBlinking": "smooth",
    "editor.cursorSmoothCaretAnimation": "on",
    "editor.fontLigatures": "'cv01', 'cv02', 'zero'",
    "editor.minimap.renderCharacters": false,
    "editor.minimap.scale": 2,
    "editor.rulers": [100],
    "editor.stickyScroll.enabled": false,
    "editor.wordWrap": "on",
    "explorer.autoReveal": false,
    "files.autoGuessEncoding": true,
    "prettier.printWidth": 100,
    "prettier.tabWidth": 4,
    "search.followSymlinks": false,
    "terminal.integrated.enableMultiLinePasteWarning": "never",
    "workbench.tree.enableStickyScroll": false,
    "workbench.tree.indent": 20,
    "Codegeex.RepoIndex": true
}

.\.clang-fromat

JSON
# .clang-format
BasedOnStyle: LLVM
AllowShortBlocksOnASingleLine: Always
AllowShortCaseExpressionOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
ColumnLimit: 100
IndentWidth: 4
原文