mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-24 11:53:09 +00:00
Read conf.d snippets as last part of share/config.fish
This allows snippets to use everything that is defined in config.fish, which is our _base_ initialization. Among other things, it enables snippets to use $PATH as it will appear in the user's config.fish, or even to change $PATH. Also, this is how it was in 2.7.1 and before (with the small change that abbrs were upgraded after).
This commit is contained in:
parent
1270bb265f
commit
64ff2f7895
1 changed files with 13 additions and 14 deletions
|
@ -184,20 +184,6 @@ function . --description 'Evaluate contents of file (deprecated, see "source")'
|
|||
end
|
||||
end
|
||||
|
||||
# As last part of initialization, source the conf directories.
|
||||
# Implement precedence (User > Admin > Extra (e.g. vendors) > Fish) by basically doing "basename".
|
||||
set -l sourcelist
|
||||
for file in $configdir/fish/conf.d/*.fish $__fish_sysconf_dir/conf.d/*.fish $__extra_confdir/*.fish
|
||||
set -l basename (string replace -r '^.*/' '' -- $file)
|
||||
contains -- $basename $sourcelist
|
||||
and continue
|
||||
set sourcelist $sourcelist $basename
|
||||
# Also skip non-files or unreadable files.
|
||||
# This allows one to use e.g. symlinks to /dev/null to "mask" something (like in systemd).
|
||||
[ -f $file -a -r $file ]
|
||||
and source $file
|
||||
end
|
||||
|
||||
# Upgrade pre-existing abbreviations from the old "key=value" to the new "key value" syntax.
|
||||
# This needs to be in share/config.fish because __fish_config_interactive is called after sourcing
|
||||
# config.fish, which might contain abbr calls.
|
||||
|
@ -305,3 +291,16 @@ function disown --wraps disown
|
|||
builtin disown (__fish_expand_pid_args $argv)
|
||||
end
|
||||
|
||||
# As last part of initialization, source the conf directories.
|
||||
# Implement precedence (User > Admin > Extra (e.g. vendors) > Fish) by basically doing "basename".
|
||||
set -l sourcelist
|
||||
for file in $configdir/fish/conf.d/*.fish $__fish_sysconf_dir/conf.d/*.fish $__extra_confdir/*.fish
|
||||
set -l basename (string replace -r '^.*/' '' -- $file)
|
||||
contains -- $basename $sourcelist
|
||||
and continue
|
||||
set sourcelist $sourcelist $basename
|
||||
# Also skip non-files or unreadable files.
|
||||
# This allows one to use e.g. symlinks to /dev/null to "mask" something (like in systemd).
|
||||
[ -f $file -a -r $file ]
|
||||
and source $file
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue