配置VSCode集成终端需修改settings.json:Windows设powershell.exe或pwsh.exe路径,macOS/Linux设zsh或自定义shell如fish的路径,并通过defaultProfile指定默认启动shell。

要在VSCode中配置集成终端以支持Zsh、PowerShell或自定义Shell,只需修改终端启动时使用的命令路径。VSCode允许通过设置指定默认Shell,适用于不同操作系统。
打开VSCode设置(Ctrl + ,),搜索“terminal integrated shell”,找到对应操作系统的设置项,或直接编辑settings.json文件。
若在Windows上希望使用PowerShell而非默认的cmd:
"terminal.integrated.shell.windows": "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"也可使用PowerShell 7(需单独安装):
"terminal.integrated.defaultProfile.windows": "PowerShell", "terminal.integrated.profiles.windows": { "PowerShell": { "source": "PowerShell", "icon": "terminal-powershell", "path": "pwsh.exe" } }macOS Catalina及以上版本默认使用Zsh。如需手动指定:
"terminal.integrated.defaultProfile.linux": "zsh", "terminal.integrated.profiles.linux": { "zsh": { "path": "/bin/zsh", "args": [] } }macOS配置类似,将linux替换为osx或统一使用跨平台设置。
若使用自定义Shell(如fish、bash特定版本等),只需提供可执行文件路径:
which fish 或 which bash
settings.json中添加:保存后,重启集成终端或新建终端实例即可生效。基本上就这些,不复杂但容易忽略细节。
以上就是如何配置VSCode的集成终端,使其支持Zsh、PowerShell或自定义Shell环境?的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号