Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

I want to set a number of universal variables, in this case to enforce XDG base directory compliance. So, I might run:

set -Ux CARGO_HOME $XDG_DATA_HOME/cargo
set -Ux GNUPGHOME $XDG_DATA_HOME/gnupg
set -Ux DOCKER_CONFIG $XDG_CONFIG_HOME/docker

This adds a few lines to my fish_variables file.

However, because I'm very particular about these things, I'd like to have a separate file -- also used by fish to set variables in the same way -- that's specifically for these variables that I've set for this purpose. Ideally, I'd be able to set up a directory for drop-in configuration. This way, all of my universal variable definitions are separated between files on the basis of their function.

One way I could potentially do this might be by adding a script to conf.d that sources all files in a given folder. In fact, the docs seem to recommend this approach:

Edit the variables through fish scripts or by using fish interactively instead.

However, the following line states:

Do not append to universal variables in config.fish, because these variables will then get longer with each new shell instance. Instead, simply set them once at the command line.

But of course, from the command line I can only have them automatically added to fish_variables.


So I suppose my question is: what's the canonical way to do this? I'd imagine I'm not the first person to be nitpicky about the structure of their stored config files, and so there's probably an obvious method I'm missing.

Maybe the solution is to save global variables, not universal ones? Then I could simply have them set on shell startup with a config snippet. Is this bad practice, considering that it's almost reinventing the universal-scope wheel?

Cheers.

You must be logged in to vote

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.