终端是什么?
人机交互的方式
命令行解释器即所谓的shell,即一个负责解释命令的程序
系统 | shell |
---|---|
Windows | cmd / powershell |
macOS | bash / zsh |
linux | bash / zsh |
如何配置VS code 终端
加上自己的shell.exe文件路径
{
"files.associations": {
"*.m": "matlab"
},
"code-runner.runInTerminal": true,
"[matlab]": {
"files.encoding": "gb2312"
},
"files.autoGuessEncoding": true,
"matlab.linterEncoding": "gb2312",
"matlab.matlabpath": "G:\\Program Files\\MATLAB\\R2017a\\bin\\matlab.exe",
"matlab.linterConfig": "G:\\Program Files\\MATLAB\\R2017a\\bin\\win64\\mlint.exe",
"matlab.mlintpath": "G:\\Program Files\\MATLAB\\R2017a\\bin\\win64\\mlint.exe",
"matlab-runner.matlabPath": "G:\\Program Files\\MATLAB\\R2017a\\bin\\matlab.exe",
"matlab-runner.tempFilePath": "C:\\Users\\dell\\Documents\\temp.m",
"matlab-runner.powershell": true,
"matlab-runner.clearPastRuns": false,
"breadcrumbs.enabled": true,
"explorer.confirmDelete": false,
"terminal.integrated.shell.linux": "G:\\Program Files\\Git\\bin\\bash.exe",
"editor.accessibilitySupport": "off",
"editor.lineNumbers": "on",
"fortran-ls.executablePath": "gfortran",
"editor.renderWhitespace": "none",
"editor.renderControlCharacters": false,
"update.enableWindowsBackgroundUpdates": false,
"update.mode": "manual",
"editor.fontSize": 16,
"workbench.iconTheme": "vscode-icons",
"workbench.activityBar.visible": true,
"code-runner.executorMap": {
"matlab": "cd $dir && matlab -nosplash -nodesktop -r $fileNameWithoutExt",
"javascript": "node",
"java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"php": "php",
"python": "python -u",
"perl": "perl",
"perl6": "perl6",
"ruby": "ruby",
"go": "go run",
"lua": "lua",
"groovy": "groovy",
"powershell": "powershell -ExecutionPolicy ByPass -File",
"bat": "cmd /c",
"shellscript": "bash",
"fsharp": "fsi",
"csharp": "scriptcs",
"vbscript": "cscript //Nologo",
"typescript": "ts-node",
"coffeescript": "coffee",
"scala": "scala",
"swift": "swift",
"julia": "julia",
"crystal": "crystal",
"ocaml": "ocaml",
"r": "Rscript",
"applescript": "osascript",
"clojure": "lein exec",
"haxe": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt",
"rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
"racket": "racket",
"scheme": "csi -script",
"ahk": "autohotkey",
"autoit": "autoit3",
"dart": "dart",
"pascal": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt",
"d": "cd $dir && dmd $fileName && $dir$fileNameWithoutExt",
"haskell": "runhaskell",
"nim": "nim compile --verbosity:0 --hints:off --run",
"lisp": "sbcl --script",
"kit": "kitc --run",
"v": "v run",
"sass": "sass --style expanded",
"scss": "scss --style expanded",
"less": "cd $dir && lessc $fileName $fileNameWithoutExt.css",
"FortranFreeForm": "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",
"fortran": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt"
},
"bracket-pair-colorizer-2.activeScopeCSS": [
"borderStyle : solid",
"borderWidth : 1px",
"borderColor : {color}",
"opacity: 0.5"
],
"window.openFilesInNewWindow": "on",
"window.openFoldersInNewWindow": "on",
"window.zoomLevel": 0,
"editor.minimap.enabled": false,
// 以下是自己添加的内容,注意每次只需添加1个,可以切换。
"terminal.integrated.shell.windows": "G:\\Program Files\\Git\\bin\\bash.exe",
//"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
//"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
}
修改或者添加之后,保存!
如何在终端中切换shell
修改json文件之后,关闭终端之后,再次新建(快捷键为 CTRL + SHIFT + `)
如需清除,可用上面的“垃圾桶”图标,每次是清楚一个终端。
+是新建终端,它是根据修改的json配置文件默认新建的,如需切换到其他Shell,可以再次修改json配置文件