set -xU CFLAGS "-g"
will set a universal variable that will persist across sessions. So this variable value must be store in the filesystem somewhere. Where exactly?
I would like to put this file under version control (git) in my ~/dotfiles/
.
To give a variable to an external command, it needs to be “exported”. Unlike other shells, fish does not have an export command. Instead, a variable is exported via an option to set , either --export or just -x .
Shell variables are stored in the memory of the running shell. Use any data structure that lets you easily look up an item given its name; a hash table is a good choice. The difference between shell variables and environment variables is that environment variables are placed in the environment of subprocesses.
The configuration file runs at every login and is located at ~/. config/fish/config. fish . Adding commands or functions to the file will execute/define them when opening a terminal, similar to .
For the first issue, all functions live in your home directory under ~/. config/fish/functions . They're automatically loaded to the list of functions you can access from the fish shell, so there's no need to add the directory to the path yourself.
Since fish version 3.0.0 the file lives in the more portable location
~/.config/fish/fish_variables
– Joey Sabey (Edited to be absolute rather than relative path)
in ~/.config/fish/fishd.(hostname)
Since it's host-specific, I'd recommend you put settings you want to share in ~/.config/fish/config.fish
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