From 4914a94ee938a395b8e615dbab96c09265fa9269 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Wed, 14 May 2025 18:15:28 +0200 Subject: [PATCH] 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`. --- .config/zsh/zshrc.d/40-functions.zsh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.config/zsh/zshrc.d/40-functions.zsh b/.config/zsh/zshrc.d/40-functions.zsh index 5c08b90..84f51c4 100644 --- a/.config/zsh/zshrc.d/40-functions.zsh +++ b/.config/zsh/zshrc.d/40-functions.zsh @@ -123,6 +123,11 @@ conf() { # check if config file exists 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 $CONF_EDITOR "$CONF_DIR/$config" return 0 @@ -136,6 +141,10 @@ conf() { # (For cases like default vim with ~/.vim/ and ~/.vimrc) if [[ "$CONF_DIR" != "$HOME" ]];then 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 if [[ -e "$HOME/.$config" ]]; then $CONF_EDITOR "$HOME/.$config"