版本比较
vscode 配置
正文
增加 391 行删除 210 行
21 行未改动2223242526272829303132333435363738394041424344454647262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816949505152535455565758591701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332346263646566676869707172737475767778798081828384858687888923523623723823924092939495969798991001011021031041051061071081092412422432442452462472482492502512522532542552562572582591112602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003011143023033041183053063073083093103119 行未改动32132232332413632532632732832920 行未改动3503513523531653543553563573589 行未改动3683693703711831841851861873723733743753763771891901911921933783793803813823831951961971981992002012022032042052062072082092102112122132142152162173843853863873883893903913923933943953963973983994004014024034044054062192202212224074084094104114122242252262274134144154164174184192292302312322332344204214224234242362372382394254264274284294304314324334344354364374384394404414424432412422432442452462472482492502512522532542552562572584444454464472602612624484494504514522642652662674534544554562692702714574584594604612732742752764624634644652782792804664674684692822832844704714724734744754764772862872882892902912924784794804812942952962972982993003013024824834844854864874884893063074904914923093103113124934944954964974984995005013185025035045055065075083255095105115125134 行未改动51851952052133852252352452552652734452852953053153253335053453553653753853935654054154254354454536254654754854955055136855255355455555655737455855956056156219 行未改动58258358458540258658758858959059159240941041141241359359459559659721 行未改动如需在 VS Code 内按快捷键编译,可创建 `.vscode/tasks.json` 文件。
```json{ "version": "2.0.0", "tasks": [ { "label": "编译 C++(评测版)", "type": "shell", "command": "g++", "args": [ "-std=c++14", "-O2", "-Wall", "-Wextra", "-g", "-Wl,--stack=1024000000", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}.exe" ], "options": { "cwd": "${fileDirname}", "shell": { "executable": "C:\\Windows\\System32\\cmd.exe", "args": ["/d", "/c"] "version": "2.0.0", "tasks": [ { "label": "编译 C++(评测版)", "type": "shell", "command": "/usr/bin/g++", "args": [ "-std=c++14", "-O2", "-Wall", "-Wextra", "-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}" ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true }, "presentation": { "reveal": "silent", "panel": "shared", "clear": true } }, { "label": "编译 C++(调试版)", "type": "shell", "command": "/usr/bin/g++", "args": [ "-std=c++14", "-O0", "-g", "-Wall", "-Wextra", "-fsanitize=address,undefined", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}" ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": false }, "presentation": { "reveal": "silent", "panel": "shared", "clear": true } }, { "label": "运行 C++", "type": "shell", "command": "${fileDirname}/${fileBasenameNoExtension}", "options": { "cwd": "${fileDirname}" }, "dependsOn": [ "编译 C++(评测版)" ], "dependsOrder": "sequence", "presentation": { "reveal": "always", "panel": "shared", "clear": true, "focus": true }, "problemMatcher": [] }, { "label": "仅运行 C++", "type": "shell", "command": "${fileDirname}/${fileBasenameNoExtension}", "options": { "cwd": "${fileDirname}" }, "presentation": { "reveal": "always", "panel": "shared", "clear": true, "focus": true }, "problemMatcher": [] }, { "label": "运行 Python", "type": "shell", "command": "python3", "args": [ "${file}" ], "options": { "cwd": "${fileDirname}" }, "presentation": { "reveal": "always", "panel": "shared", "clear": true, "focus": true }, "problemMatcher": [] } ]}```windows 中:
```json{ "version": "2.0.0", "tasks": [ { "label": "编译 C++(评测版)", "type": "shell", "command": "g++", "args": [ "-std=c++14", "-O2", "-Wall", "-Wextra", "-g", "${file}", "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe", "-static-libgcc", "-static-libstdc++" ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ }, "problemMatcher": ["$gcc"], "group": { "kind": "build", "isDefault": true }, "presentation": { "reveal": "silent", "panel": "shared", "clear": true } "$gcc" ], "group": { "kind": "build", "isDefault": true }, "presentation": { "reveal": "silent", "panel": "shared", "clear": true } }, { "label": "运行 C++", "type": "shell", "command": "${fileDirname}\\${fileBasenameNoExtension}.exe", "options": { "cwd": "${fileDirname}" }, "dependsOn": [ "编译 C++(评测版)" ], "dependsOrder": "sequence", "presentation": { "reveal": "always", "panel": "shared", "clear": true, "focus": true }, "problemMatcher": [] }, { "label": "运行 Python", "type": "shell", "command": "python", "args": [ "${file}" ], "options": { "cwd": "${fileDirname}" }, "presentation": { "reveal": "always", "panel": "shared", "clear": true, "focus": true }, "problemMatcher": [] } ]}```
## 一键编译运行
`Preferences: Open Keyboard Shortcuts (JSON)`
```json[ { "key": "ctrl+shift+b", "command": "workbench.action.tasks.build", "when": "resourceLangId == cpp" }, { "label": "编译 C++(调试版)", "type": "shell", "command": "g++", "args": [ "-std=c++14", "-O0", "-g", "-Wall", "-Wextra", "-Wl,--stack=1024000000", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}.exe" ], "options": { "cwd": "${fileDirname}", "shell": { "executable": "C:\\Windows\\System32\\cmd.exe", "args": ["/d", "/c"] } }, "problemMatcher": ["$gcc"], "group": "build", "presentation": { "reveal": "silent", "panel": "shared", "clear": true } "key": "ctrl+f5", "command": "workbench.action.tasks.runTask", "args": "运行 C++", "when": "resourceLangId == cpp" }, { "label": "运行 C++", "type": "shell", "command": "${fileDirname}/${fileBasenameNoExtension}.exe", "options": { "cwd": "${fileDirname}" }, "dependsOn": ["编译 C++(评测版)"], "dependsOrder": "sequence", "group": { "kind": "test", "isDefault": true }, "presentation": { "reveal": "always", "panel": "shared", "clear": true }, "problemMatcher": [] "key": "ctrl+alt+r", "command": "workbench.action.tasks.runTask", "args": "仅运行 C++", "when": "resourceLangId == cpp" }, { "key": "ctrl+alt+p", "command": "workbench.action.tasks.runTask", "args": "运行 Python", "when": "resourceLangId == python" }, { "key": "ctrl+alt+z", "command": "glassit.increase" }, { "key": "ctrl+alt+c", "command": "glassit.decrease" } ]]```
# launch.json
```json{ "version": "0.2.0", "configurations": [ { "name": "调试 C++(开栈 512MB)", "type": "cppdbg", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}", "args": [], "stopAtEntry": false, "cwd": "${fileDirname}", "environment": [], "externalConsole": false, "MIMode": "gdb", "preLaunchTask": "编译 C++(调试版)", "setupCommands": [ { "description": "启用 shell 启动,使 ulimit 生效", "text": "-gdb-set startup-with-shell on", "ignoreFailures": true }, { "description": "设置栈大小为 512MB(524288 KB)", "text": "-gdb-set exec-wrapper sh -c 'ulimit -s 524288 && exec \"$@\"' --", "ignoreFailures": true }, { "description": "为 gdb 启用整齐打印", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } ]}```配置后,按 `Ctrl+Shift+B` 即可编译当前文件。
# 颜色配置
```txt`Preferences: Open User Settings (JSON)`
```json{ "vs64.showWelcome": false, "code-runner.runInTerminal": true, "editor.fontSize": 20,9 行未改动 "terminal.integrated.enableMultiLinePasteWarning": "never"}```
```txt```json{ "workbench.colorCustomizations": { "editorCursor.foreground": "#ffffff", "editorCursor.background": "#ffffff",20 行未改动 }}```
```txt```json{ "vs64.showWelcome": false, "code-runner.runInTerminal": true, "editor.fontSize": 20,9 行未改动 "editor.insertSpaces": false, "terminal.integrated.enableMultiLinePasteWarning": "never",
"workbench.colorCustomizations": { "activityBar.background": "#040A12", "activityBar.foreground": "#26C6DA", "activityBar.inactiveForeground": "#2A4A5A", "activityBarBadge.background": "#0288D1", "activityBarBadge.foreground": "#040A12", "activityBar.background": "#0D1117", "activityBar.foreground": "#39C5BB", "activityBar.inactiveForeground": "#484F58", "activityBarBadge.background": "#39C5BB", "activityBarBadge.foreground": "#0D1117",
"sideBar.background": "#040A12", "sideBar.foreground": "#A9C2D9", "sideBarTitle.foreground": "#26C6DA", "sideBarSectionHeader.background": "#07101E", "sideBarSectionHeader.foreground": "#4DB6AC", "sideBar.background": "#0D1117", "sideBar.foreground": "#C9D1D9", "sideBarTitle.foreground": "#39C5BB", "sideBarSectionHeader.background": "#161B22", "sideBarSectionHeader.foreground": "#58A6FF",
"editor.background": "#040A12", "editor.foreground": "#A9C2D9", "editorLineNumber.foreground": "#1E3A4A", "editorLineNumber.activeForeground": "#26C6DA", "editorCursor.foreground": "#4DB6AC", "editor.selectionBackground": "#0288D144", "editor.inactiveSelectionBackground": "#0288D122", "editor.lineHighlightBackground": "#07101E", "editor.findMatchBackground": "#26C6DA66", "editor.findMatchHighlightBackground": "#0288D144", "editorWhitespace.foreground": "#0F2233", "editorIndentGuide.background1": "#0F2233", "editorIndentGuide.activeBackground1": "#26C6DA", "editorBracketMatch.background": "#0288D133", "editorBracketMatch.border": "#0288D1", "editorGutter.background": "#040A12", "editorGroupHeader.tabsBackground": "#040A12", "editorGroup.border": "#0F2233", "editorOverviewRuler.border": "#0F2233", "editorError.foreground": "#E57399", "editorWarning.foreground": "#D4B85C", "editorInfo.foreground": "#26C6DA", "editorHint.foreground": "#4DB6AC", "editor.background": "#0D1117", "editor.foreground": "#FFFFFF", "editorLineNumber.foreground": "#484F58", "editorLineNumber.activeForeground": "#39C5BB", "editorCursor.foreground": "#39C5BB", "editor.selectionBackground": "#39C5BB44", "editor.inactiveSelectionBackground": "#39C5BB22", "editor.lineHighlightBackground": "#161B22", "editor.findMatchBackground": "#39C5BB66", "editor.findMatchHighlightBackground": "#39C5BB44", "editorWhitespace.foreground": "#21262D", "editorIndentGuide.background1": "#21262D", "editorIndentGuide.activeBackground1": "#39C5BB", "editorBracketMatch.background": "#39C5BB33", "editorBracketMatch.border": "#39C5BB", "editorGutter.background": "#0D1117", "editorGroup.border": "#21262D", "editorOverviewRuler.border": "#21262D", "editorError.foreground": "#F85149", "editorWarning.foreground": "#D29922", "editorInfo.foreground": "#39C5BB", "editorHint.foreground": "#39C5BB",
"statusBar.background": "#05293F", "statusBar.foreground": "#A9C2D9", "statusBar.noFolderBackground": "#040A12", "statusBar.debuggingBackground": "#0288D1", "statusBar.background": "#0A192F", "statusBar.foreground": "#FFFFFF", "statusBar.noFolderBackground": "#0D1117", "statusBar.debuggingBackground": "#39C5BB", "statusBar.debuggingForeground": "#0A192F",
"titleBar.activeBackground": "#040A12", "titleBar.activeForeground": "#26C6DA", "titleBar.inactiveBackground": "#040A12", "titleBar.inactiveForeground": "#2A4A5A", "tab.activeBackground": "#0D1117", "tab.activeForeground": "#FFFFFF", "tab.inactiveBackground": "#0D1117", "tab.inactiveForeground": "#5A8A9A", "tab.border": "#161B22", "tab.activeBorderTop": "#39C5BB",
"tab.activeBackground": "#040A12", "tab.activeForeground": "#4DB6AC", "tab.inactiveBackground": "#040A12", "tab.inactiveForeground": "#456A7A", "tab.border": "#07101E", "tab.activeBorderTop": "#26C6DA", "panel.background": "#0D1117", "panel.border": "#21262D", "panelTitle.activeForeground": "#39C5BB", "panelTitle.inactiveForeground": "#484F58",
"panel.background": "#040A12", "panel.border": "#0F2233", "panelTitle.activeForeground": "#26C6DA", "panelTitle.inactiveForeground": "#456A7A", "terminal.background": "#0D1117", "terminal.foreground": "#FFFFFF", "terminal.ansiBlack": "#0D1117", "terminal.ansiRed": "#F85149", "terminal.ansiGreen": "#39C5BB", "terminal.ansiYellow": "#D29922", "terminal.ansiBlue": "#58A6FF", "terminal.ansiMagenta": "#BC8CFF", "terminal.ansiCyan": "#39C5BB", "terminal.ansiWhite": "#FFFFFF", "terminal.ansiBrightBlack": "#484F58", "terminal.ansiBrightRed": "#FF7B72", "terminal.ansiBrightGreen": "#39C5BB", "terminal.ansiBrightYellow": "#E3B341", "terminal.ansiBrightBlue": "#79C0FF", "terminal.ansiBrightMagenta": "#D2A8FF", "terminal.ansiBrightCyan": "#39C5BB", "terminal.ansiBrightWhite": "#FFFFFF",
"terminal.background": "#040A12", "terminal.foreground": "#A9C2D9", "terminal.ansiBlack": "#040A12", "terminal.ansiRed": "#E57399", "terminal.ansiGreen": "#26A69A", "terminal.ansiYellow": "#4DB6AC", "terminal.ansiBlue": "#0288D1", "terminal.ansiMagenta": "#29B6F6", "terminal.ansiCyan": "#26C6DA", "terminal.ansiWhite": "#A9C2D9", "terminal.ansiBrightBlack": "#1E3A4A", "terminal.ansiBrightRed": "#F48FB1", "terminal.ansiBrightGreen": "#4DB6AC", "terminal.ansiBrightYellow": "#80CBC4", "terminal.ansiBrightBlue": "#42A5F5", "terminal.ansiBrightMagenta": "#81D4FA", "terminal.ansiBrightCyan": "#80DEEA", "terminal.ansiBrightWhite": "#E0F7FA", "button.background": "#39C5BB", "button.foreground": "#0A192F", "button.hoverBackground": "#4DB6AC",
"button.background": "#0288D1", "button.foreground": "#040A12", "button.hoverBackground": "#26C6DA", "input.background": "#161B22", "input.foreground": "#FFFFFF", "input.border": "#21262D", "inputOption.activeBorder": "#39C5BB",
"input.background": "#07101E", "input.foreground": "#A9C2D9", "input.border": "#0288D1", "inputOption.activeBorder": "#26C6DA", "dropdown.background": "#161B22", "dropdown.foreground": "#FFFFFF", "dropdown.border": "#21262D",
"dropdown.background": "#07101E", "dropdown.foreground": "#A9C2D9", "dropdown.border": "#0288D1", "list.activeSelectionBackground": "#39C5BB33", "list.activeSelectionForeground": "#FFFFFF", "list.hoverBackground": "#161B22", "list.highlightForeground": "#39C5BB",
"list.activeSelectionBackground": "#0288D133", "list.activeSelectionForeground": "#A9C2D9", "list.hoverBackground": "#07101E", "list.highlightForeground": "#26C6DA", "scrollbarSlider.background": "#39C5BB33", "scrollbarSlider.hoverBackground": "#39C5BB55", "scrollbarSlider.activeBackground": "#39C5BB88",
"scrollbarSlider.background": "#26C6DA33", "scrollbarSlider.hoverBackground": "#26C6DA55", "scrollbarSlider.activeBackground": "#26C6DA88", "badge.background": "#39C5BB", "badge.foreground": "#0A192F", "progressBar.background": "#39C5BB",
"badge.background": "#0288D1", "badge.foreground": "#040A12", "progressBar.background": "#26C6DA", "editorWidget.background": "#161B22", "editorWidget.border": "#21262D", "editorSuggestWidget.background": "#161B22", "editorSuggestWidget.border": "#21262D", "editorSuggestWidget.selectedBackground": "#39C5BB33", "editorHoverWidget.background": "#161B22", "editorHoverWidget.border": "#21262D",
"editorWidget.background": "#07101E", "editorWidget.border": "#0288D1", "editorSuggestWidget.background": "#07101E", "editorSuggestWidget.border": "#0288D1", "editorSuggestWidget.selectedBackground": "#0288D133", "editorHoverWidget.background": "#07101E", "editorHoverWidget.border": "#0288D1", "peekView.border": "#39C5BB", "peekViewEditor.background": "#0D1117", "peekViewResult.background": "#0D1117",
"peekView.border": "#26C6DA", "peekViewEditor.background": "#040A12", "peekViewResult.background": "#040A12",
"gitDecoration.addedResourceForeground": "#26A69A", "gitDecoration.modifiedResourceForeground": "#29B6F6", "gitDecoration.deletedResourceForeground": "#E57399", "gitDecoration.untrackedResourceForeground": "#26C6DA", "gitDecoration.ignoredResourceForeground": "#2A4A5A" "gitDecoration.addedResourceForeground": "#39C5BB", "gitDecoration.modifiedResourceForeground": "#58A6FF", "gitDecoration.deletedResourceForeground": "#F85149", "gitDecoration.untrackedResourceForeground": "#39C5BB", "gitDecoration.ignoredResourceForeground": "#484F58" },
"editor.tokenColorCustomizations": { "comments": "#3B5A6B", "strings": "#4DB6AC", "comments": "#5A7A8A", "strings": "#80CBC4", "keywords": "#26C6DA", "numbers": "#80CBC4", "types": "#42A5F5", "functions": "#26A69A", "variables": "#A9C2D9", "numbers": "#4DD0E1", "types": "#80DEEA", "functions": "#00BFA5", "variables": "#FFFFFF",
"textMateRules": [ { "scope": ["comment", "punctuation.definition.comment"], "settings": { "foreground": "#3B5A6B", "foreground": "#5A7A8A", "fontStyle": "italic" } }, { "scope": ["string", "punctuation.definition.string"], "settings": { "foreground": "#4DB6AC" "foreground": "#80CBC4" } }, { "scope": ["keyword", "storage.type", "storage.modifier"],4 行未改动 }, { "scope": ["entity.name.function", "support.function"], "settings": { "foreground": "#26A69A" "foreground": "#00BFA5" } }, { "scope": ["variable", "variable.parameter"], "settings": { "foreground": "#A9C2D9" "foreground": "#FFFFFF" } }, { "scope": ["constant.numeric", "constant.language"], "settings": { "foreground": "#80CBC4" "foreground": "#4DD0E1" } }, { "scope": ["entity.name.type", "support.type", "support.class", "storage.type"], "settings": { "foreground": "#42A5F5" "foreground": "#80DEEA" } }, { "scope": ["constant.other", "variable.language"], "settings": { "foreground": "#0288D1" "foreground": "#00BCD4" } }, { "scope": ["keyword.operator"], "settings": { "foreground": "#456A7A" "foreground": "#6A8A9A" } }, { "scope": ["punctuation", "meta.brace"], "settings": { "foreground": "#456A7A" "foreground": "#6A8A9A" } }, { "scope": ["markup.heading"],19 行未改动 "background.enabled": true, "background.editor": { "images": [ "file:///home/你的用户名/Pictures/bg.jpg" "/usr/share/backgrounds/vscode-bg.jpg" ], "useFront": false, "style": { "background-position": "center center", "background-size": "cover", "opacity": 0.08, "background-repeat": "no-repeat", "filter": "brightness(0.6) contrast(0.8)" }, "interval": 0, "random": false "background-repeat": "no-repeat" } }}```