From 45210b6c8f2886b4a11e0d2d6c140241cde13d80 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Tue, 19 Apr 2022 11:25:37 +0200 Subject: [PATCH] Adds cdw alias --- zsh/aliases.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 16fc1e1..f847920 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -60,6 +60,14 @@ mkcd() { mkdir $1 && cd $1 } +# which && cd +cdw() { + f=`which $1` + if [ $? -eq 0 ]; then + cd `dirname $f` + fi +} + # Initialize thefuck command -v thefuck > /dev/null 2>&1