bash and zsh (and possibly many other shells) have a function that allows you to run an arbitrary command before the prompt appears. You can use this for the source of the .dirrc file and it will not break tab completion.
Here's how to do it in bash :
PROMPT_COMMAND=' if [ "${PREV}" != "$(pwd -P)" ]; then if [ -r .dirrc ]; then . ./.dirrc fi PREV=$(pwd -P) fi '
On the bash man page:
PROMPT_COMMAND : if set, the value is executed as a command before each initial prompt is PROMPT_COMMAND .
Here's how to do it in zsh (see the zshmisc man page):
precmd() { if [ "${PREV}" != "$(pwd -P)" ]; then if [ -r .dirrc ]; then . ./.dirrc fi PREV=$(pwd -P) fi }
source share