I've recently started using Fish Shell and I really like it since I spend most of my time using the shell, Fish's IntelliSense-like completion is handy.
One thing that bugged me is the lack of being able to easily separate environment variables into separate files so I added this little block inside my fish_prompt function in /etc/fish/functions/fish_prompt.fish :
1 2 3 4 5 6 7 8 9 |
if not set -q __fish_sourced_env for fsh in (ls /etc/fish/env/*.fish) source $fsh end for fsh in (ls $HOME/.config/fish/env/*.fish ^ /dev/null) #it doesn't matter if it doesn't exist source $fsh end set -g __fish_sourced_env 1 end |
Now you can put different aliases / exports in /etc/fish/env/$HOME/.config/fish/env/.
Of course if you're doing this for one command, for example go related exports (GOROOT, GOPATH, etc) it's better to put it in /etc/fish/functions/go.fish and it will be automatically sources the first time you type go.