diff -r acd29a6e6d8d -r c3dc97f8c1d2 .bashrc --- a/.bashrc Tue Nov 08 23:20:39 2011 +0200 +++ b/.bashrc Fri Nov 18 01:06:42 2011 +0200 @@ -232,13 +232,18 @@ complete -F _mycd -o nospace cd _man() { + local p 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 ) ) + local IFS=': +' + for p in /usr/share/man $MANPATH; do + p=( $p/man*/* ) + p=( ${p[@]##*/} ) + p=( ${p[@]%.gz} ) + p=( ${p[@]%.*} ) + p=( $(compgen -W '${p[@]}' -- $cur ) ) + COMPREPLY=( ${COMPREPLY[@]} ${p[@]} ) + done } complete -F _man man