How can I ask fish
to enumerate the locations it's reading configuration from?
I don't believe this is possible.
Which specific paths I need to backup if I want to preserve my shell experience,
These are all listed in the documentation, but the most important ones are probably your own configuration files:
~/.config/fish/config.fish
~/.config/fish/completions
~/.config/fish/functions
Initialization files
Configuration files are evaluated in the following order:
Configuration shipped with fish, which should not be edited, in $__fish_data_dir/config.fish
(usually
/usr/share/fish/config.fish
).
Configuration snippets in files ending in .fish
, in the directories:
$__fish_config_dir/conf.d
(by default, ~/.config/fish/conf.d/
)
$__fish_sysconf_dir/conf.d
(by default, /etc/fish/conf.d/
)
Directories for third-party software vendors to ship their own configuration snippets for their software. Fish searches the
directories in the XDG_DATA_DIRS
environment variable for a
fish/vendor_conf.d
directory; if this variable is not defined, the
default is usually to search /usr/share/fish/vendor_conf.d
and
/usr/local/share/fish/vendor_conf.d
If there are multiple files with the same name in these directories, only the first will be executed. They are executed in
order of their filename, sorted (like globs) in a natural order (i.e.
"01" sorts before "2").
System-wide configuration files, where administrators can include initialization that should be run for all users on the system -
similar to /etc/profile
for POSIX-style shells - in
$__fish_sysconf_dir
(usually /etc/fish/config.fish
).
User initialization, usually in ~/.config/fish/config.fish
(controlled by the XDG_CONFIG_HOME
environment variable, and
accessible as $__fish_config_dir
).
These paths are controlled by parameters set at build, install, or run
time, and may vary from the defaults listed above.
This wide search may be confusing. If you are unsure where to put your
own customisations, use ~/.config/fish/config.fish
.
Note that ~/.config/fish/config.fish
is sourced after the
snippets. This is so users can copy snippets and override some of
their behavior.
Source: Introduction — fish-shell 3.1.2 documentation
Where to put completions
Completions can be defined on the commandline or in a configuration
file, but they can also be automatically loaded. Fish automatically
searches through any directories in the list variable
$fish_complete_path
, and any completions defined are automatically
loaded when needed. A completion file must have a filename consisting
of the name of the command to complete and the suffix '.fish
'.
By default, Fish searches the following for completions, using the
first available file that it finds:
- A directory for end-users to keep their own completions, usually
~/.config/fish/completions
(controlled by the XDG_CONFIG_HOME
environment variable);
- A directory for systems administrators to install completions for all users on the system, usually
/etc/fish/completions
;
- Directories for third-party software vendors to ship their own completions for their software. Fish searches the directories in the
XDG_DATA_DIRS
environment variable for a fish/vendor_completions.d
directory; if this variable is not defined, the default is usually to
search /usr/share/fish/vendor_completions.d
and
/usr/local/share/fish/vendor_completions.d
;
- The completions shipped with fish, usually installed in
/usr/share/fish/completions
; and
- Completions automatically generated from the operating system's manuals, usually stored in
~/.local/share/fish/generated_completions
.
These paths are controlled by parameters set at build, install, or run
time, and may vary from the defaults listed above.
This wide search may be confusing. If you are unsure, your completions
probably belong in ~/.config/fish/completions
.
Source: Introduction — fish-shell 3.1.2 documentation
Autoloading functions
Functions can be defined on the commandline or in a configuration
file, but they can also be automatically loaded. This has some
advantages:
- An autoloaded function becomes available automatically to all running shells.
- If the function definition is changed, all running shells will automatically reload the altered version.
- Startup time and memory usage is improved, etc.
When fish needs to load a function, it searches through any
directories in the list variable $fish_function_path
for a file with
a name consisting of the name of the function plus the suffix
'.fish
' and loads the first it finds.
By default $fish_function_path
contains the following:
- A directory for end-users to keep their own functions, usually
~/.config/fish/functions
(controlled by the XDG_CONFIG_HOME
environment variable).
- A directory for systems administrators to install functions for all users on the system, usually
/etc/fish/functions
(really
$__fish_sysconfdir/functions
).
- Directories for third-party software vendors to ship their own functions for their software. Fish searches the directories in the
XDG_DATA_DIRS
environment variable for a fish/vendor_functions.d
directory; if this variable is not defined, the default is usually to
search /usr/share/fish/vendor_functions.d
and
/usr/local/share/fish/vendor_functions.d.
- The functions shipped with fish, usually installed in
/usr/share/fish/functions
(really $__fish_data_dir/functions
).
These paths are controlled by parameters set at build, install, or run
time, and may vary from the defaults listed above.
This wide search may be confusing. If you are unsure, your functions
probably belong in ~/.config/fish/functions
.
Source: Introduction — fish-shell 3.1.2 documentation
How can I determine where variables and colors are being set
Look in the initialisation files listed above.