Like some other bugs about bash-completion, this one also about aliases/functions. I've this in ~/.bashrc: ---cut--- [[ -f /etc/profile.d/bash-completion ]] && source /etc/profile.d/bash-completion function man() { vim -c "Man $1 $2"; } ---cut--- After typing `perldoc <TAB>` bash hangs because it execute vim instead of man. To solve this line 5061 of /etc/bash_completion should be patched to execute ... PAGER=cat command man perl ... instead of ... PAGER=cat man perl ... I don't know is it better to report this upstream of fix in gentoo-specific patch.
My suggestion would be to improve upon your man() function, since I think it could cause problems for other things, and because I don't think it's practical to prefix every call to everything in the bash completion scripts with "command" or "builtin". For example: man() { if [[ -t 1 ]] ; then vim -c "Man $1 $2" else man "${@}" fi } The [[ -t 1 ]] test means "If stdout is a real terminal." So, if man is called in a pipe, it will call the real man command instead.
Alex, if you're still interested in getting this fixed, report it to upstream at http://bash-completion.alioth.debian.org/. They may want to use 'command' and 'builtin', but we won't add a patch for it if it's not included in the official release. Thanks for reporting and sorry for the delay in response.