From 26a6eb47d5a729d12dab5d95e5c8f6540b8d31c7 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Wed, 16 Apr 2025 19:35:12 -0400 Subject: [PATCH] AutoYADM commit: 2025-04-16 19:35:12 --- .config/fish/functions/cd.fish | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.config/fish/functions/cd.fish b/.config/fish/functions/cd.fish index e1b9dd0c..9c97c8cb 100644 --- a/.config/fish/functions/cd.fish +++ b/.config/fish/functions/cd.fish @@ -1,11 +1,12 @@ -# Defined via `source` +# One-time setup, preserve original cd definition +if not functions -q __cd_orig + functions --copy cd __cd_orig +end + function cd --wraps=cd --description "Change directory. No args goes to git root or $HOME." - set -l cdfunc /usr/share/fish/functions/cd.fish if test (count $argv) -ne 0; or not git rev-parse --is-inside-work-tree &>/dev/null - source $cdfunc - cd $argv + __cd_orig $argv else - source $cdfunc - cd (git rev-parse --show-toplevel) + __cd_orig (git rev-parse --show-toplevel) end end