Only read .fish files in the snippets directories

This would allow us to add a README and allows users to easily disable
something temporarily.
This commit is contained in:
Fabian Homborg 2016-03-26 19:16:17 +01:00
parent ad97a122c9
commit 7accadc33f
2 changed files with 2 additions and 2 deletions

View file

@ -1088,7 +1088,7 @@ function on_exit --on-process %self
end end
\endfish \endfish
Right after reading /usr/share/fish/config.fish and before reading /etc/fish/config.fish, fish will also read files in ~/.config/fish/conf.d/, /etc/fish/conf.d and /usr/share/fish/vendor_conf.d (the exact values depend on $XDG_CONFIG_HOME, $__fish_sysconfdir and $__fish_datadir). If there are files with the same name in two or all of these, fish will only attempt to read the first (skipping all files with that name if it is unreadable). ~/.config takes precedence over /etc/ which takes precedence over /usr. The path to the latter can also be gotten via `pkg-config` as "confdir", and is meant for third-party applications to integrate with fish. Right after reading /usr/share/fish/config.fish and before reading /etc/fish/config.fish, fish will also read files ending in ".fish" in ~/.config/fish/conf.d/, /etc/fish/conf.d and /usr/share/fish/vendor_conf.d (the exact values depend on $XDG_CONFIG_HOME, $__fish_sysconfdir and $__fish_datadir). If there are files with the same name in two or all of these, fish will only attempt to read the first (skipping all files with that name if it is unreadable). ~/.config takes precedence over /etc/ which takes precedence over /usr. The path to the latter can also be gotten via `pkg-config` as "confdir", and is meant for third-party applications to integrate with fish.
\section other Other features \section other Other features

View file

@ -157,7 +157,7 @@ end
# As last part of initialization, source the conf directories # As last part of initialization, source the conf directories
# Implement precedence (User > Admin > Vendors > Fish) by basically doing "basename" # Implement precedence (User > Admin > Vendors > Fish) by basically doing "basename"
set -l sourcelist set -l sourcelist
for file in $configdir/fish/conf.d/* $__fish_sysconfdir/conf.d/* $__fish_datadir/vendor_conf.d/* for file in $configdir/fish/conf.d/*.fish $__fish_sysconfdir/conf.d/*.fish $__fish_datadir/vendor_conf.d/*.fish
set -l basename (string replace -r '^.*/' '' -- $file) set -l basename (string replace -r '^.*/' '' -- $file)
contains -- $basename $sourcelist; and continue contains -- $basename $sourcelist; and continue
set sourcelist $sourcelist $basename set sourcelist $sourcelist $basename