zshrc: Make `cd()\ behave with more than one argument
authorFrank Terbeck <ft@grml.org>
Thu, 18 Aug 2011 16:36:32 +0000 (18:36 +0200)
committerFrank Terbeck <ft@grml.org>
Thu, 18 Aug 2011 16:36:32 +0000 (18:36 +0200)
etc/zsh/zshrc

index a34b170..5d908f0 100644 (file)
@@ -2786,12 +2786,12 @@ fir() {
 }
 # smart cd function, allows switching to /etc when running 'cd /etc/fstab'
 cd() {
-    if [[ -f ${1} ]]; then
+    if (( ${#argv} == 1 )) && [[ -f ${1} ]]; then
         [[ ! -e ${1:h} ]] && return 1
         print "Correcting ${1} to ${1:h}"
         builtin cd ${1:h}
     else
-        builtin cd ${1}
+        builtin cd "$@"
     fi
 }