[英]Is there an environment variables config file for Mac Visual Studio?
[英]How does Visual Studio Code (VSCode) know environment variables set in ~/.config/fish/config.fish?
环境:
我使用 fish 作为默认 shell,几乎所有环境变量,包括$PATH
,都设置在~/.config/fish/config.fish
( ~/.bash_profile
中的~/.bash_profile
)中。 当我使用 Visual Studio Code 时,它知道在~/.config/fish/config.fish
设置的环境变量,尽管它的父进程是/sbin/launchd
,而不是fish。 这是怎么发生的?
此chsh -s /usr/local/bin/fish
命令使 Fish Shell 成为您的默认登录 (1) shell(如在 MacOS自述文件上安装 Fish shell 中所述)。 除非另有说明,Fish 将用作所有内容的默认 shell。
$PATH
每次启动新的 Fish Shell 实例时,它都会查看~/.config/fish/config.fish
文件以进行配置和调整; 在里面你可能设置了$PATH
变量,它会被输入到$PATH
变量中。
使用的 shell 在 Linux 和 macOS 上默认为 $SHELL,在 Windows 10 上默认为 PowerShell,在早期版本的 Windows 上使用 cmd.exe。 这些可以通过在用户设置中设置 terminal.integrated.shell.* 手动覆盖。 可以使用 terminal.integrated.shellArgs.* 用户设置将参数传递给终端外壳阅读有关配置外壳的更多信息
在 OSX 中,它是terminal.integrated.shell.osx
属性,它通过默认(空)或用户指定的 shell 调用 $SHELL
login(1) --> 设置$SHELL = /usr/local/bin/fish
--> Visual Studio Code 获取$SHELL
--> 启动一个新的 Fish Shell 实例 --> Fish Shell 加载~/.config/fish/config.fish
--> 设置$PATH
和其他配置
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.