VS code中关于终端(Terminal)的配置和切换

终端是什么?

人机交互的方式

在这里插入图片描述
在这里插入图片描述
命令行解释器即所谓的shell,即一个负责解释命令的程序

系统shell
Windowscmd / powershell
macOSbash / zsh
linuxbash / 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配置文件
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大雨海深

感谢您的支持和鼓励

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值