跳到正文

个人记录

vscode的配置

MrPigcken约 5 分钟
原文
文章信息与版本

文章信息

发布
2026年5月15日
收录
2026年7月14日
更新
2026年11月17日
篇幅
约 5 分钟
获赞
1

版本

  1. v1当前

主题,括号颜色配置:

ctrl+shift+p打开命令,搜索“settings.json”,选择“首选项:打开用户设置(JSON)”,复制下文代码。

setting.json代码
Java
{
    "editor.bracketPairColorization.enabled": true,
    "editor.guides.bracketPairs": "active",
    "workbench.colorCustomizations": {
        "editorBracketHighlight.foreground1": "#ffd700",
        "editorBracketHighlight.foreground2": "#da70d6",
        "editorBracketHighlight.foreground3": "#179fff",
        "editorBracketHighlight.foreground4": "#24d600",
        "editorBracketHighlight.foreground5": "#00d8d8",
        "editorBracketHighlight.foreground6": "#ff89ba"
    },
    "workbench.colorTheme": "Shades of Purple (Super Dark)"
}

C++代码片段配置:

ctrl+shift+p打开命令,搜索“snippets”,选择“代码片段:配置代码片段”,复制下文代码。

cpp.json代码
Java
{
	"cpp":{
		"prefix": "cpp",
		"body": ["#include<bits/stdc++.h>",
				"#define int long long",
				"#define double long double",
				"#define endl '\\n'",
				"using namespace std;",
				"const int N=3e5+7;",
				"int n;",
				"void mian(){",
				"    cin>>n;",
				"    return;",
				"}",
				"signed main(){",
				"    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);",
				"    int _77231=1;",
				"    // cin>>_77231;",
				"    while(_77231--)mian();",
				"    return 0;",
				"}$0"
			],
		"description": "C++ template"
	}
}

C++ vscode 生成exe:

在原文件同目录下创建“.vscode”文件夹,新建“tasks.json”,复制下文代码

tasks.json代码
Java
{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe 生成活动文件——编译运行",
            "command": "C:\\mingw64\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\#${fileBasenameNoExtension}#",
                "-std=c++26",
                "-O2",
                "-I\"C:\\mingw64\\include\"",
                "-I\"C:\\mingw64\\x86_64-w64-mingw32\\include\"",
                "-I\"C:\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\15.2.0\\include\"",
                "-I\"C:\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\15.2.0\\include\\c++\"",
                "-L\"C:\\mingw64\\lib\"",
                "-L\"C:\\mingw64\\x86_64-w64-mingw32\\lib\""
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "调试器生成的任务。"
        }
    ],
    "version": "2.0.0"
}
原文