zsh:conf: Stop opening ~/.config as a fallback

This has been a bug for far too long. The entries `config`, `conf` and
`config.ini` of `CONF_PATTERNS` only make sense when looking outside of
`HOME`.
This commit is contained in:
2025-05-14 18:15:28 +02:00
parent 6d5245a56e
commit 4914a94ee9

View File

@@ -123,6 +123,11 @@ conf() {
# check if config file exists # check if config file exists
for config in $CONF_PATTERNS; do for config in $CONF_PATTERNS; do
# when looking in HOME, skip entries of CONF_PATTERNS, if they
# do not start with the given program name (i.e. they are
# generic)
[[ $CONF_DIR != $HOME || ${config#$1} != $config ]] || continue
if [[ -e "$CONF_DIR/$config" ]]; then if [[ -e "$CONF_DIR/$config" ]]; then
$CONF_EDITOR "$CONF_DIR/$config" $CONF_EDITOR "$CONF_DIR/$config"
return 0 return 0
@@ -136,6 +141,10 @@ conf() {
# (For cases like default vim with ~/.vim/ and ~/.vimrc) # (For cases like default vim with ~/.vim/ and ~/.vimrc)
if [[ "$CONF_DIR" != "$HOME" ]];then if [[ "$CONF_DIR" != "$HOME" ]];then
for config in $CONF_PATTERNS; do for config in $CONF_PATTERNS; do
# skip entries of CONF_PATTERNS, if they do not start
# with the given program name (i.e. they are generic)
[[ ${config#$1} != $config ]] || continue
# Only look for hidden files # Only look for hidden files
if [[ -e "$HOME/.$config" ]]; then if [[ -e "$HOME/.$config" ]]; then
$CONF_EDITOR "$HOME/.$config" $CONF_EDITOR "$HOME/.$config"