From 64ff2f7895ee42ac423d595aa3c495f592048b26 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Tue, 12 Jun 2018 22:28:26 +0200 Subject: [PATCH] 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). --- share/config.fish | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/share/config.fish b/share/config.fish index c6ccfc4e4..06be25adb 100644 --- a/share/config.fish +++ b/share/config.fish @@ -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