【发布时间】:2018-05-07 20:17:29
【问题描述】:
我在 Windows 10 上安装了 Ubuntu 应用程序,我想将其用作 VS Code 中的终端。我看到 VS Code 会自动检测 Git Bash、PowerShell、Cmd.exe 等选项,并提供将它们用作终端的选项。但我想使用 Ubuntu。有可能吗?
【问题讨论】:
标签: ubuntu visual-studio-code windows-10
我在 Windows 10 上安装了 Ubuntu 应用程序,我想将其用作 VS Code 中的终端。我看到 VS Code 会自动检测 Git Bash、PowerShell、Cmd.exe 等选项,并提供将它们用作终端的选项。但我想使用 Ubuntu。有可能吗?
【问题讨论】:
标签: ubuntu visual-studio-code windows-10
对于专门使用 Ubuntu 发行版,您只需键入一个简单的命令即可将 wsl 使用的默认发行版更改为 ubuntu。
在cmd中输入wslconfig /setdefault Ubuntu就可以了。
然后在我的电脑上,vscode 给了我选择我想使用的终端的选项,所以我选择了 wsl bash,所以它在 Preferences->settings 中编辑了用户设置"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\bash.exe"。上面的代码覆盖了默认设置。
您的电脑可能有不同的路径,请参阅stackoverflow link to configure vscode for wsl as terminal
wsl配置也可以参考微软链接https://docs.microsoft.com/en-us/windows/wsl/wsl-config
可以参考similar question as yours for ubuntu and multiple distros
【讨论】: