.bashrc
changeset 241 e1e0eeee8d51
parent 240 62bea4f80160
child 242 a13e9cd16022
child 244 64924a7c3689
equal deleted inserted replaced
240:62bea4f80160 241:e1e0eeee8d51
   206   esac
   206   esac
   207   return 0
   207   return 0
   208 }
   208 }
   209 complete -F _pathsearch -o nospace pathsearch
   209 complete -F _pathsearch -o nospace pathsearch
   210 
   210 
       
   211 _mycd() {
       
   212   local cur
       
   213   cur=${COMP_WORDS[COMP_CWORD]}
       
   214   if [[ -z "${CDPATH:-}" || "$cur" == ?(.)?(.)/* ]]; then
       
   215     COMPREPLY=( $(compgen -d -- "$cur") )
       
   216     return 0
       
   217   fi
       
   218   for i in ${CDPATH//:/$'\n'}; do
       
   219     k="${#COMPREPLY[@]}"
       
   220     for j in $( compgen -d $i/$cur ); do
       
   221       COMPREPLY[k++]=${j#$i/}
       
   222     done
       
   223   done
       
   224   return 0
       
   225 }
       
   226 complete -F _mycd -o nospace cd
       
   227 
       
   228 _man() {
       
   229   local cur=${COMP_WORDS[COMP_CWORD]}
       
   230   manpath=/usr/share/man
       
   231   COMPREPLY=( $manpath/man*/* )
       
   232   COMPREPLY=( ${COMPREPLY[@]##*/} )
       
   233   COMPREPLY=( ${COMPREPLY[@]%.gz} )
       
   234   COMPREPLY=( ${COMPREPLY[@]%.*} )
       
   235   COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- $cur ) )
       
   236 }
       
   237 complete -F _man man
       
   238 
   211 # Use bash-completion, if available.
   239 # Use bash-completion, if available.
   212 if [ -f /etc/bash_completion ]; then
   240 if [ -f /etc/bash_completion ]; then
   213   # Under Cygwin bash completition start a long time.
   241   # Under Cygwin bash completition start a long time.
   214   if [ ! "$OSTYPE" = cygwin ]; then
   242   if [ ! "$OSTYPE" = cygwin ]; then
   215     . /etc/bash_completion
   243     . /etc/bash_completion