Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best way to add environmental variable to set Fish configuration directory. #2

Closed
frederickjh opened this issue Mar 26, 2020 · 3 comments

Comments

@frederickjh
Copy link
Contributor

frederickjh commented Mar 26, 2020

This is related to #1 and this comment.

Fish normally finds or puts its configuration files in ~/.config/fish. This can be changed by setting the environmental variable `XDG_CONFIG_HOME'.

Using this line from entrypoint.sh as starting point,

export XXH_HOME=`dirname $CURRENT_DIR/../../../../p`

We could add something like this after it,

export XDG_CONFIG_HOME=`dirname $CURRENT_DIR/../../../../.xxh-shell-fish/config`

to set the configuration directory for the Fish shell.

@anki-code
Copy link
Member

anki-code commented Mar 27, 2020

Common way is to place default config in the xxh-shell directory.

Xonsh shell example:

  1. xonshrc.xsh is in the shell directory - it will be copied to build dir by build.sh and will be in ~/.xxh/xxh/shells/xxh-shell-xonsh-appimage/build directory along with entrypoint.sh
  2. when you do xxh myhost it upload build dir to the host and calls entrypoint.sh which calls xonshrc.xsh file when run xonsh
  3. xonshrc.xsh init/source/import plugins

On the step 2 and 3 inside shellrc and pluginrc scripts you can get the directory where this scripts are placed (or use global environment variable $XXH_HOME which set in entrypoint.sh).

If you need to copy config files from xxh-shell to $XXH_HOME to save this between xxh updates:

  1. Add this files to build dir by modifying xxh-shell-fish/build.sh
  2. Add the code to fishrc.fish which check that $XXH_HOME/.fish-configs is not exists and make copy from ~/.xxh/xxh/shells/xxh-shell-fish/build/fish-configs to $XXH_HOME/.fish-configs.
  3. If $XXH_HOME/.fish-configs exists then load configs from there.

But in common case it's not needed. Configs could be a part of the xxh-shell-fish/build directory and in bash, zsh, xonsh I avoided using $XXH_HOME. My be my cases were simple.

@frederickjh
Copy link
Contributor Author

frederickjh commented Mar 27, 2020

Fish shell documentation on Initialization files and Startup.

frederickjh added a commit to frederickjh/xxh-shell-fish that referenced this issue Mar 27, 2020
@frederickjh
Copy link
Contributor Author

Closing as it was fixed in commit 5a3181b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants