Created
October 15, 2010 15:21
-
-
Save ronin13/628368 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd () { | |
emulate -LR zsh | |
if [[ $# -ge 3 ]]; then | |
echo cd: too many arguments >&2 | |
return 1 | |
elif [[ $# -eq 2 ]]; then | |
## builtin cd $1 $2 | |
local newdir=${(S)PWD//$1/$2} | |
echo $newdir | |
builtin cd $newdir | |
elif [[ $# -eq 1 ]]; then | |
if [[ ! -d $1 && -d $1:h ]]; then | |
echo $1:h | |
builtin cd $1:h | |
else | |
builtin cd $1 | |
fi | |
else | |
builtin cd | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment