Created
April 15, 2022 18:59
-
-
Save kamack38/80c6a10107e1f4589c43a23c6078ec09 to your computer and use it in GitHub Desktop.
C++ VScode Windows 10 Setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ensure that file is run as admin | |
Write-Host "Checking for elevated permissions..." | |
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { | |
Write-Warning "Insufficient permissions to run this script. Open the PowerShell console as an administrator and run this script again." | |
Break | |
} | |
else { | |
Write-Host "Script is running as administrator - go on executing the script..." -ForegroundColor Green | |
} | |
# Set location to powershell script root | |
Set-Location -Path $PSScriptRoot | |
# Checking execution policy | |
Write-Host "Checking execution policy..." | |
$executionPolicy = (Get-ExecutionPolicy) | |
$allowedExecutionPolicies = @( | |
"RemoteSigned", | |
"Bypass", | |
"Unrestricted" | |
) | |
if ($executionPolicy -in $allowedExecutionPolicies) { | |
Write-Host "Execution policy is set to $executionPolicy. Continuing script execution." -ForegroundColor Green | |
} | |
else { | |
Write-Warning "Execution policy is set to $executionPolicy which is NOT recomended." | |
Break | |
} | |
# Send welcome message | |
Clear-Host | |
Write-Output " ___ __ _____ ______ ________ ________" | |
Write-Output " |\ \|\ \ |\ _ \ _ \|\_____ \|\ __ \ " | |
Write-Output " \ \ \/ /|\ \ \\\__\ \ \|_____\ \ \ \|\ \ Kamack38" | |
Write-Output " \ \ ___ \ \ \\|__| \ \|______ \ \ __ \ https://twitter.com/kamack38" | |
Write-Output " \ \ \\ \ \ \ \ \ \ \| ____\ \ \ \|\ \ https://github.com/kamack38" | |
Write-Output " \ \__\\ \__\ \__\ \ \__\|\_______\ \_______\ " | |
Write-Output " \|__| \|__|\|__| \|__|\|_______|\|_______| " | |
Write-Output " " | |
Write-Output "Thank you for downloading my C++ configuration <3" | |
# Ensure chocolatey is installed | |
if (! (Get-Command choco -errorAction SilentlyContinue)) { | |
Write-Host "Chocolatey needs to be installed!" -ForegroundColor red | |
Write-Host "Installing Chocolatey..." -ForegroundColor yellow | |
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) | |
Write-Host "Chocolatey has been installed succesfully!" -ForegroundColor green | |
Write-Host "Refreshing environment variables..." -ForegroundColor yellow | |
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") | |
Write-Host "Environment variables has been refreshed!" -ForegroundColor green | |
} | |
else { | |
Write-Host "Chocolatey is already installed!" -ForegroundColor green | |
} | |
Write-Host "Installing programs..." -ForegroundColor yellow | |
choco install vscode.install --params "/NoDesktopIcon" --limit-output | |
choco install mingw --limit-output | |
choco install llvm --limit-output | |
if ($?) { | |
Write-Host "Programs have been installed successfully!" -ForegroundColor green | |
} | |
# Refresh environmental variables | |
Write-Host "Refreshing environment variables..." -ForegroundColor yellow | |
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") | |
Write-Host "Environment variables has been refreshed!" -ForegroundColor green | |
$extensions = 'jeff-hykin.better-cpp-syntax', 'aaron-bond.better-comments', 'ms-vscode.cpptools', 'Hyeon.c-math-viewer', 'austin.code-gnu-global', 'formulahendry.code-runner', 'streetsidesoftware.code-spell-checker', 'streetsidesoftware.code-spell-checker-polish', 'VisualStudioExptTeam.vscodeintellicode', 'cschlosser.doxdocgen', 'icrawl.discord-vscode' | |
foreach ($ext in $extensions) { | |
code --install-extension $ext | |
} | |
if (!(Test-Path "$PSScriptRoot\cppsettings.json")) { | |
Write-Host "No C++ settings file found!" -ForegroundColor red | |
exit 1 | |
} | |
else { | |
Write-Host "C++ settings file found!" -ForegroundColor green | |
} | |
$settings = (Get-Content "$PSScriptRoot\cppsettings.json") | |
$VSCSettingsPath = "$env:APPDATA\Code\User\settings.json" | |
if (!(Test-Path $VSCSettingsPath)) { | |
Write-Warning "No VSCode settings file found!" | |
Write-Host "Creating settings file..." -ForegroundColor yellow | |
New-Item -Path $VSCSettingsPath -ItemType File -Value $settings | |
} | |
else { | |
Write-Host "VSCode settings file found!" -ForegroundColor green | |
Write-Host "Writing to file..." -ForegroundColor yellow | |
Set-Content -Path $VSCSettingsPath -Value $settings | |
} | |
if ($?) { | |
Write-Host "Settings has been successfully installed!" -ForegroundColor green | |
} | |
else { | |
Write-Host "There has been some errors!" - ForegroundColor red | |
Write-Output $Error | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"configurations": [ | |
{ | |
"name": "Win32", | |
"includePath": [ | |
"C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/include/c++/11.2.0/**", | |
"C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/include/c++/11.2.0/x86_64-w64-mingw32/" | |
], | |
"defines": ["_DEBUG", "UNICODE", "_UNICODE"], | |
"windowsSdkVersion": "10.0.19041.0", | |
"compilerPath": "C:/ProgramData/chocolatey/bin/g++.exe", | |
"cStandard": "c17", | |
"cppStandard": "c++17", | |
"intelliSenseMode": "windows-gcc-x64" | |
} | |
], | |
"version": 4 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"C_Cpp.autocompleteAddParentheses": true, | |
"C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 500 }", | |
"C_Cpp.clang_format_path": "C:\\Program Files\\LLVM\\bin\\clang-format.exe", | |
"C_Cpp.codeAnalysis.clangTidy.checks.enabled": ["cppcoreguidelines-*", "clang-analyzer-core.*"], | |
"C_Cpp.codeAnalysis.clangTidy.checks.disabled": ["cppcoreguidelines-avoid-*"], | |
"C_Cpp.codeAnalysis.clangTidy.args": ["-std=c++11", "-x", "c++"], | |
"C_Cpp.codeAnalysis.clangTidy.enabled": false, | |
"C_Cpp.codeAnalysis.clangTidy.path": "C:\\Program Files\\LLVM\\bin\\clang-tidy.exe", | |
"[cpp]": { | |
"editor.defaultFormatter": "ms-vscode.cpptools" | |
}, | |
"cSpell.language": "en-GB,pl", | |
"code-runner.executorMap": { | |
"FortranFreeForm": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt", | |
"ahk": "autohotkey", | |
"applescript": "osascript", | |
"autoit": "autoit3", | |
"bat": "cmd /c", | |
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt", | |
"clojure": "lein exec", | |
"coffeescript": "coffee", | |
"cpp": "$folder = $dirWithoutTrailingSlash + \"\\bin\"; if (!(Test-Path $folder)) { New-Item -Type Directory -Path $folder | Out-Null}; cd $folder && g++ \"../$fileName\" -o \"$fileNameWithoutExt\" && & './$fileNameWithoutExt'", | |
"crystal": "crystal", | |
"csharp": "scriptcs", | |
"d": "cd $dir && dmd $fileName && $dir$fileNameWithoutExt", | |
"dart": "dart", | |
"fortran": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt", | |
"fortran-modern": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt", | |
"fortran_fixed-form": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt", | |
"fsharp": "fsi", | |
"go": "go run", | |
"groovy": "groovy", | |
"haskell": "runhaskell", | |
"haxe": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt", | |
"java": "cd $dir && javac $fileName && java $fileNameWithoutExt", | |
"javascript": "node", | |
"julia": "julia", | |
"kit": "kitc --run", | |
"less": "cd $dir && lessc $fileName $fileNameWithoutExt.css", | |
"lisp": "sbcl --script", | |
"lua": "lua", | |
"nim": "nim compile --verbosity:0 --hints:off --run", | |
"objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt", | |
"ocaml": "ocaml", | |
"pascal": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt", | |
"perl": "perl", | |
"perl6": "perl6", | |
"php": "php", | |
"powershell": "cd $dir && powershell -ExecutionPolicy ByPass -File $fileName", | |
"python": "python -u", | |
"r": "Rscript", | |
"racket": "racket", | |
"ruby": "ruby", | |
"rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt", | |
"sass": "sass --style expanded", | |
"scala": "scala", | |
"scheme": "csi -script", | |
"scss": "scss --style expanded", | |
"shellscript": "bash", | |
"swift": "swift", | |
"typescript": "ts-node", | |
"v": "v run", | |
"vbscript": "cscript //Nologo" | |
}, | |
"code-runner.preserveFocus": false, | |
"code-runner.runInTerminal": true, | |
"code-runner.saveFileBeforeRun": true, | |
"debug.internalConsoleOptions": "neverOpen", | |
"diffEditor.codeLens": true, | |
"diffEditor.ignoreTrimWhitespace": false, | |
"diffEditor.wordWrap": "on", | |
"discord.idleTimeout": 1200, | |
"editor.bracketPairColorization.enabled": true, | |
"editor.cursorBlinking": "smooth", | |
"editor.cursorSmoothCaretAnimation": true, | |
"editor.cursorStyle": "line", | |
"editor.defaultFormatter": null, | |
"editor.fontFamily": "FiraCode NF", | |
"editor.fontLigatures": true, | |
"editor.fontWeight": "500", | |
"editor.formatOnPaste": true, | |
"editor.formatOnSave": true, | |
"editor.guides.bracketPairs": "active", | |
"editor.guides.bracketPairsHorizontal": "active", | |
"editor.guides.highlightActiveIndentation": true, | |
"editor.hover.above": true, | |
"editor.lineNumbers": "on", | |
"editor.linkedEditing": true, | |
"editor.parameterHints.enabled": true, | |
"editor.quickSuggestionsDelay": 0, | |
"editor.renderWhitespace": "selection", | |
"editor.snippetSuggestions": "top", | |
"editor.suggestSelection": "first", | |
"editor.tabCompletion": "on", | |
"editor.unicodeHighlight.allowedCharacters": { | |
"Ą": true, | |
"ą": true, | |
"Ć": true, | |
"ć": true, | |
"Ę": true, | |
"ę": true, | |
"Ł": true, | |
"ł": true, | |
"Ń": true, | |
"ń": true, | |
"Ó": true, | |
"ó": true, | |
"Ś": true, | |
"ś": true, | |
"Ż": true, | |
"ż": true, | |
"Ź": true, | |
"ź": true | |
}, | |
"editor.unicodeHighlight.ambiguousCharacters": true, | |
"editor.unicodeHighlight.invisibleCharacters": true, | |
"editor.unicodeHighlight.nonBasicASCII": true, | |
"editor.wordWrap": "on", | |
"explorer.compactFolders": false, | |
"explorer.confirmDelete": false, | |
"explorer.confirmDragAndDrop": false, | |
"files.defaultLanguage": "${activeEditorLanguage}", | |
"files.eol": "\n", | |
"git.autofetch": true, | |
"git.confirmSync": false, | |
"git.enableCommitSigning": true, | |
"git.enableSmartCommit": true, | |
"launch": { | |
"compounds": [], | |
"configurations": [ | |
{ | |
"MIMode": "gdb", | |
"args": [], | |
"cwd": "${fileDirname}\\bin", | |
"environment": [], | |
"externalConsole": false, | |
"miDebuggerPath": "C:\\ProgramData\\chocolatey\\bin\\gdb.exe", | |
"name": "C/C++ - Build and debug", | |
"preLaunchTask": "C/C++: build active file (g++)", | |
"program": "${fileDirname}/bin/${fileBasenameNoExtension}.exe", | |
"request": "launch", | |
"setupCommands": [ | |
{ | |
"description": "Enable pretty-printing for gdb", | |
"ignoreFailures": true, | |
"text": "-enable-pretty-printing" | |
} | |
], | |
"stopAtEntry": false, | |
"type": "cppdbg" | |
} | |
] | |
}, | |
"material-icon-theme.folders.associations": { | |
".bin": "dist" | |
}, | |
"task.quickOpen.showAll": true, | |
"terminal.explorerKind": "external", | |
"terminal.external.windowsExec": "C:\\Users\\kamack38\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe", | |
"terminal.integrated.commandsToSkipShell": ["psl.stepIn", "psl.stepOut", "psl.stepOver", "psl.sendToHostTerminal"], | |
"terminal.integrated.confirmOnKill": "never", | |
"terminal.integrated.cursorStyle": "line", | |
"terminal.integrated.defaultProfile.windows": "PowerShell", | |
"terminal.integrated.fontSize": 14, | |
"terminal.integrated.localEchoExcludePrograms": ["vim", "vi", "nano", "tmux", "nvim"], | |
"terminal.integrated.profiles.windows": { | |
"PowerShell": { | |
"args": ["-NoExit", "-NoLogo", "-ExecutionPolicy", "Bypass"], | |
"path": "pwsh.exe" | |
} | |
}, | |
"terminal.integrated.tabs.enabled": true, | |
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue", | |
"workbench.colorCustomizations": { | |
// Brackets | |
"editorBracketHighlight.foreground1": "#FFB86C", | |
"editorBracketHighlight.foreground2": "#FF75B5", | |
"editorBracketHighlight.foreground3": "#45A9F9", | |
"editorBracketHighlight.foreground4": "#B084EB", | |
"editorBracketHighlight.foreground5": "#E6E6E6", | |
"editorBracketHighlight.foreground6": "#6fce85", | |
"editorBracketHighlight.unexpectedBracket.foreground": "#eb3247", | |
"editorBracketMatch.background": "#515a6b", | |
"editorBracketMatch.border": "#f9c4408f", | |
"editorBracketPairGuide.activeBackground1": "#FFB86C", | |
"editorBracketPairGuide.activeBackground2": "#FF75B5", | |
"editorBracketPairGuide.activeBackground3": "#45A9F9", | |
"editorBracketPairGuide.activeBackground4": "#B084EB", | |
"editorBracketPairGuide.activeBackground5": "#E6E6E6", | |
"editorBracketPairGuide.activeBackground6": "#6fce85" | |
}, | |
"workbench.editor.wrapTabs": true, | |
"workbench.editorAssociations": { | |
"*.lnk": "default", | |
"*.ttf": "default" | |
}, | |
"workbench.iconTheme": "material-icon-theme", | |
"zenMode.hideLineNumbers": false, | |
"editor.minimap.enabled": false, | |
"terminal.integrated.enablePersistentSessions": false, | |
"terminal.integrated.enableMultiLinePasteWarning": false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment