diff --git a/zsh/zshrc b/zsh/zshrc index 29329f3..4a115db 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -293,10 +293,12 @@ alias em='emacsclient' # `cd /path/to/a/file` does `cd /path/to/a` function cd () { - if [[ -f $1 ]]; then - builtin cd $1:h + if [[ -f "$1" ]]; then + builtin cd "${1:h}" + elif [[ "$1" = "" ]]; then + builtin cd else - builtin cd $1 + builtin cd "$1" fi }