equal
deleted
inserted
replaced
58 _mycd() { |
58 _mycd() { |
59 local cur |
59 local cur |
60 cur=${COMP_WORDS[COMP_CWORD]} |
60 cur=${COMP_WORDS[COMP_CWORD]} |
61 if [[ -z "${CDPATH:-}" ]] || [[ $cur == ?(.)?(.)/* ]] || [[ $cur == '~'/* ]]; then |
61 if [[ -z "${CDPATH:-}" ]] || [[ $cur == ?(.)?(.)/* ]] || [[ $cur == '~'/* ]]; then |
62 COMPREPLY=( $(compgen -d -- "$cur") ) |
62 COMPREPLY=( $(compgen -d -- "$cur") ) |
|
63 COMPREPLY=${COMPREPLY[@]/%//} |
63 return 0 |
64 return 0 |
64 fi |
65 fi |
65 local i j k |
66 local i j k |
66 k=0 |
67 k=0 |
67 for i in ${CDPATH//:/$'\n'}; do |
68 for i in ${CDPATH//:/$'\n'}; do |
68 for j in $( compgen -d -- $i/$cur ); do |
69 for j in $( compgen -d -- $i/$cur ); do |
69 COMPREPLY[k++]=${j#$i/} |
70 COMPREPLY[k++]=${j#$i/}/ |
70 done |
71 done |
71 done |
72 done |
72 return 0 |
73 return 0 |
73 } |
74 } |
74 complete -F _mycd -o nospace cd |
75 complete -F _mycd -o nospace cd |