From 6d5245a56ec50719874c4304129873db88e46113 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Wed, 14 May 2025 18:08:19 +0200 Subject: [PATCH] zsh:conf: Remove trailing slashes before processing Previously when the program name had a trailing slash, `conf` would not find the right file as it would check for filenames that include a slash (e.g. `prog/rc`). This was especially annoying, since conf's completion function inserts a slash automatically when subdirectories exists. --- .config/zsh/zshrc.d/40-functions.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.config/zsh/zshrc.d/40-functions.zsh b/.config/zsh/zshrc.d/40-functions.zsh index 37bba32..5c08b90 100644 --- a/.config/zsh/zshrc.d/40-functions.zsh +++ b/.config/zsh/zshrc.d/40-functions.zsh @@ -90,6 +90,10 @@ conf() { printf "\033[1;31mPlease specify a config.\n\033[0m" >&2 return 1 fi + + # remove trailing slashes + 1="${(*)1%%/#}" + # search for program name in XDG_CONFIG_HOME and $HOME local CONF_DIR="$(_get_config_dir "$1")" if (( $? )); then