.bashrc
changeset 253 70b18b0b9e53
parent 252 2fa0c2abe304
child 254 8963bce11ed5
equal deleted inserted replaced
252:2fa0c2abe304 253:70b18b0b9e53
   220   cur=${COMP_WORDS[COMP_CWORD]}
   220   cur=${COMP_WORDS[COMP_CWORD]}
   221   if [[ -z "${CDPATH:-}" || "$cur" == ?(.)?(.)/* ]]; then
   221   if [[ -z "${CDPATH:-}" || "$cur" == ?(.)?(.)/* ]]; then
   222     COMPREPLY=( $(compgen -d -- "$cur") )
   222     COMPREPLY=( $(compgen -d -- "$cur") )
   223     return 0
   223     return 0
   224   fi
   224   fi
       
   225   local i j k
   225   for i in ${CDPATH//:/$'\n'}; do
   226   for i in ${CDPATH//:/$'\n'}; do
   226     k="${#COMPREPLY[@]}"
   227     k="${#COMPREPLY[@]}"
   227     for j in $( compgen -d $i/$cur ); do
   228     for j in $( compgen -d $i/$cur ); do
   228       COMPREPLY[k++]=${j#$i/}
   229       COMPREPLY[k++]=${j#$i/}
   229     done
   230     done
   242   COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- $cur ) )
   243   COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- $cur ) )
   243 }
   244 }
   244 complete -F _man man
   245 complete -F _man man
   245 
   246 
   246 _make() {
   247 _make() {
   247   local mk
   248   local i mk
   248   local cur=${COMP_WORDS[COMP_CWORD]}
   249   local cur=${COMP_WORDS[COMP_CWORD]}
   249   [[ $COMP_CWORD > 0 ]] && prev=${COMP_WORDS[COMP_CWORD-1]}
   250   [[ $COMP_CWORD > 0 ]] && prev=${COMP_WORDS[COMP_CWORD-1]}
   250   if [[ $prev = -f ]]; then
   251   if [[ $prev = -f ]]; then
   251     COMPREPLY=( $(compgen -f -- "$cur") )
   252     COMPREPLY=( $(compgen -f -- "$cur") )
   252     return 0
   253     return 0