VSCode 设置git bash终端

背景:

vscode 只有 PowerShell 和 Command Prompt。这让人很不舒适,于是网上搜罗了一番了,可惜都是些陈芝麻烂谷子,没一个能用的。

流程:   

  文件 》 首选项 》 设置

  1、在搜索框中搜索:terminal.integrated.profiles.windows

 

 

 

点击下方:在 settings.json 中编辑,进入到 settings.json 文件

内容:

{
    "security.workspace.trust.untrustedFiles": "open",
    "editor.formatOnSave": true,
    "[go]": {
        "editor.formatOnSave": false,
        "editor.formatOnType": false
    },
    "go.toolsManagement.autoUpdate": true,
    "terminal.integrated.profiles.windows": {
    
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [],
            "icon": "terminal-cmd"
        },
        "Git Bash": {
            "source": "Git Bash"
        }
    },
    "terminal.integrated.defaultProfile.windows": "GitBash"
}

之后将终端配置写进去。

注意:

"terminal.integrated.defaultProfile.windows": "GitBash"

PS:

  1、这一条设置后,就会在打开终端后,默认使用 bash 作为终端了。

  2、Git Bash 的路径请填你自己电脑上 bash.exe 的位置。

最后,务必重启 VSCode 编辑器,然后打开终端重试即可。



如图:

 

 

posted @ 2022-09-16 09:29  萤huo虫  阅读(1599)  评论(0编辑  收藏  举报