From f8cb23ec539c1710a045456b4207cf10c9ba56ce Mon Sep 17 00:00:00 2001
From: crater2150 <crater@qwertyuiop.de>
Date: Wed, 25 Jan 2023 10:11:02 +0100
Subject: [PATCH] xdg-wrappers/rg: set config path only on existing file

---
 xdg-wrappers/rg | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xdg-wrappers/rg b/xdg-wrappers/rg
index fe26674..03269a6 100755
--- a/xdg-wrappers/rg
+++ b/xdg-wrappers/rg
@@ -1,4 +1,7 @@
 #!/bin/zsh
 source ${$(realpath "$0"):h:h}/lib/next-in-path.zsh
-export RIPGREP_CONFIG_PATH=${XDG_CONFIG_HOME:-$HOME/.config}/ripgreprc
+RIPGREP_CONFIG_PATH=${XDG_CONFIG_HOME:-$HOME/.config}/ripgreprc
+if [[ -e $RIPGREP_CONFIG_PATH ]]; then
+	export RIPGREP_CONFIG_PATH
+fi
 $(next-in-path rg $0) $@