diff -r 62bea4f80160 -r e1e0eeee8d51 .bashrc --- a/.bashrc Wed Oct 26 02:58:22 2011 +0300 +++ b/.bashrc Wed Oct 26 02:59:36 2011 +0300 @@ -208,6 +208,34 @@ } complete -F _pathsearch -o nospace pathsearch +_mycd() { + local cur + cur=${COMP_WORDS[COMP_CWORD]} + if [[ -z "${CDPATH:-}" || "$cur" == ?(.)?(.)/* ]]; then + COMPREPLY=( $(compgen -d -- "$cur") ) + return 0 + fi + for i in ${CDPATH//:/$'\n'}; do + k="${#COMPREPLY[@]}" + for j in $( compgen -d $i/$cur ); do + COMPREPLY[k++]=${j#$i/} + done + done + return 0 +} +complete -F _mycd -o nospace cd + +_man() { + local cur=${COMP_WORDS[COMP_CWORD]} + manpath=/usr/share/man + COMPREPLY=( $manpath/man*/* ) + COMPREPLY=( ${COMPREPLY[@]##*/} ) + COMPREPLY=( ${COMPREPLY[@]%.gz} ) + COMPREPLY=( ${COMPREPLY[@]%.*} ) + COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- $cur ) ) +} +complete -F _man man + # Use bash-completion, if available. if [ -f /etc/bash_completion ]; then # Under Cygwin bash completition start a long time.