Is it possible to start fish shell to point to another config directory, then the default ~/.config/fish?
I am trying to have same-behaving shell experience in multi-user system across different users (eq. while sudo -u <user> fish have the same aliases/functions etc. like under my user). But also have this in non-persistant way as other users in the system might not be interested in my settings.
So far my ideas were:
~/.config/fish/functions/) It's clear from your comments to the answer provided by Glenn that your original question left out some important information. If you're working on a system that has other users that will also sudo -u $some_user you should not symlink to your personal config files. Instead just leverage the fact that fish is compliant with the XDG Base Directory specification. Simply set env var XDG_CONFIG_HOME to your real home dir before starting fish. For example,
sudo -u $some_user /bin/sh -c "XDG_CONFIG_HOME=$HOME/.config fish"
You could put all the common stuff in a common directory, perhaps
/opt/fish_config/config.fish
/opt/fish_config/functions/
/opt/fish_config/completions/
Then in any ~/.config/fish/config.fish you can put:
source /opt/fish_config/config.fish
and in /opt/fish_config/config.fish, in addition to your own fish stuff, be sure to add:
set fish_function_path $fish_function_path /opt/fish_config/functions
set fish_complete_path $fish_complete_path /opt/fish_config/completions
Just using a symlink is probably easier, although file permissions might be an issue.
Personally, although I don't share my config across multiple users on the same machine, I share my config across multiple machines: my fish config is in git, and I symlink ~/.config/fish to the git directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With