From 408e1aa8b0e6cad54473b4ff9af8d4656ffce07e Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Wed, 16 Apr 2025 19:40:12 -0400 Subject: [PATCH] AutoYADM commit: 2025-04-16 19:40:12 --- .config/fish/config.fish | 13 +++++++++++++ .config/fish/functions/cd.fish | 12 ------------ .config/fish/functions/gcd.fish | 3 --- 3 files changed, 13 insertions(+), 15 deletions(-) delete mode 100644 .config/fish/functions/cd.fish delete mode 100644 .config/fish/functions/gcd.fish diff --git a/.config/fish/config.fish b/.config/fish/config.fish index 992b635d..c5048602 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -1,4 +1,17 @@ if status is-interactive + + 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." + if test (count $argv) -ne 0; or not git rev-parse --is-inside-work-tree &>/dev/null + __cd_orig $argv + else + __cd_orig (git rev-parse --show-toplevel) + end + end + starship init fish | source direnv hook fish | source zoxide init fish | source diff --git a/.config/fish/functions/cd.fish b/.config/fish/functions/cd.fish deleted file mode 100644 index 9c97c8cb..00000000 --- a/.config/fish/functions/cd.fish +++ /dev/null @@ -1,12 +0,0 @@ -# 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." - if test (count $argv) -ne 0; or not git rev-parse --is-inside-work-tree &>/dev/null - __cd_orig $argv - else - __cd_orig (git rev-parse --show-toplevel) - end -end diff --git a/.config/fish/functions/gcd.fish b/.config/fish/functions/gcd.fish deleted file mode 100644 index b25baad5..00000000 --- a/.config/fish/functions/gcd.fish +++ /dev/null @@ -1,3 +0,0 @@ -function gcd --description 'cd to the root of current git repo' - cd (git rev-parse --show-toplevel) -end