在vscode(windows)中配置一个纯bash的终端

1,363 阅读1分钟

说明

说一下为啥要搞这个,第一是花里胡哨,凑个博文;第二是powershell有些linux命令还是不能用的,至少没有Git Bash支持的多,而且powershell是cmd和bash混合,不够纯粹,初学者学习起来难免容易混。

准备

首先windows上要装Git Bash

怎么做

  1. 找到bash命令所在的位置 我的是 D:\Git\bin\bash.exe

image.png

  1. vscode中设置中搜索 terminal.integrated.profiles.windows

image.png

  1. 编辑settings.json

"terminal.integrated.profiles.windows": { 行下新建一个Bash对象,或者其它什么名字都行,path中填bash命令所在的路径

"terminal.integrated.profiles.windows": {
        "Bash": {
            "path": [
                "D:\\Git\\bin\\bash.exe"
            ],
            "args": [],
            "icon": "terminal-bash"
        },
        "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"
        }
    },
...
  1. 搞定收工

image.png

现在就可以安心使用linux上的命令了