配置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
若在Windows上希望使用PowerShell而非默认的cmd:
“terminal.integrated.shell.windows”: “C:WindowsSystem32WindowsPowerShellv1.0powershell.exe”
也可使用PowerShell 7(需单独安装):
“terminal.integrated.defaultProfile.windows”: “PowerShell”, “terminal.integrated.profiles.windows”: { “PowerShell”: { “source”: “PowerShell”, “icon”: “terminal-powershell”, “path”: “pwsh.exe” } }
macOS 或 Linux 上使用 Zsh
macOS Catalina及以上版本默认使用Zsh。如需手动指定:
如知AI笔记
如知笔记——支持markdown的在线笔记,支持ai智能写作、AI搜索,支持DeepseekR1满血大模型
27 查看详情
“terminal.integrated.defaultProfile.linux”: “zsh”, “terminal.integrated.profiles.linux”: { “zsh”: { “path”: “/bin/zsh”, “args”: [] } }
macOS配置类似,将linux替换为osx或统一使用跨平台设置。
设置自定义Shell
若使用自定义Shell(如fish、bash特定版本等),只需提供可执行文件路径:
确认Shell路径:在终端运行 which fish 或 which bash 在settings.json中添加: “terminal.integrated.profiles.linux”: { “Fish”: { “path”: “/usr/bin/fish” } }, “terminal.integrated.defaultProfile.linux”: “Fish”
保存后,重启集成终端或新建终端实例即可生效。基本上就这些,不复杂但容易忽略细节。
以上就是如何配置VSCode的集成终端,使其支持Zsh、PowerShell或自定义Shell环境?的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/434326.html
微信扫一扫
支付宝扫一扫