diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2009-12-27 07:46:56 +0100 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-12-27 07:46:56 +0100 |
commit | f95ebfc5d2b0c93ee1d84ea741c0764cf87478bb (patch) | |
tree | 0dbb7e3f9dc3e6d4a59f3393c4bb679271af6067 /etc | |
parent | 336a085ae9d2b6993c952708d4c001ea4b2b6135 (diff) |
rtab: Don't show a single . for a dotdir
Diffstat (limited to 'etc')
-rw-r--r-- | etc/functions/rtab | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/etc/functions/rtab b/etc/functions/rtab index 0145237..7444fef 100644 --- a/etc/functions/rtab +++ b/etc/functions/rtab @@ -75,6 +75,8 @@ if (( named )) { tree=(${(s:/:)dir}) ( unfunction chpwd 2> /dev/null + + # Start either in the currrent named directory or in / if [[ $tree[1] == \~* ]] { cd ${~tree[1]} result=$tree[1] @@ -87,19 +89,20 @@ tree=(${(s:/:)dir}) result+="/$tree" break } + + # required for the until loop expn=(a b) part='' i=0 - until [[ (( ${#expn} == 1 )) || $dir = $expn || $i -gt 99 ]] do + until [[ (( ${#expn} == 1 )) || $dir == $expn || $i -gt 99 ]] do (( i++ )) part+=$dir[$i] expn=($(echo ${part}*(-/))) - if ((short)) { - if [[ $dir[$i] == . ]] { - expn=(a b) - } else { - break - } + # Never show a single . as directory + if [[ $i == 1 && $dir[$i] == . ]] { + expn=(a b) + } elif [[ $short == 1 ]] { + break } done result+="/$part" |