diff --git a/.bash_completion.d/direnv b/.bash_completion.d/direnv
new file mode 100644
index 0000000000000000000000000000000000000000..a1058a5ec2ee7fbe5c19522c3835ff86e7bfefa8
--- /dev/null
+++ b/.bash_completion.d/direnv
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+if which direnv > /dev/null
+then
+    [ -f "$HOME/.bash_completion.d/.direnv" ] || direnv hook bash > "$HOME/.bash_completion.d/.direnv"
+    # shellcheck disable=SC1090
+    . "$HOME/.bash_completion.d/.direnv"
+fi
diff --git a/.bashrc b/.bashrc
index f283b59e75995ac3a7cff55fe7c220ed39bf2759..cb18d8f7fa039ff601078ec6cca224b8386e5209 100644
--- a/.bashrc
+++ b/.bashrc
@@ -2,32 +2,6 @@
 # If not running interactively, don't do anything
 [ -z "$PS1" ] && return
 
-if [ -n "${BASH:-}" ]
-then
-    shopt -s histappend
-    shopt -s checkwinsize
-    shopt -s cmdhist
-    export PROMPT_COMMAND="history -a"
-    [ -f /etc/bash_completion ] && . /etc/bash_completion
-
-    # shellcheck disable=SC1090
-    for sourcefile in $HOME/.bash_completion.d/*
-    do
-        [ ! -f "$sourcefile" ] || . "$sourcefile"
-    done
-fi
-
-# make less more friendly for non-text input files, see lesspipe(1)
-[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
-
-# enable color support of ls and also add handy aliases
-if [ -x /usr/bin/dircolors ]; then
-    eval "$(dircolors -b)"
-    alias ls='ls --color=auto'
-    alias grep='grep --color=auto'
-    alias diff='diff --color=auto'
-fi
-
 export LANG=en_US.UTF8
 export HISTFILE="$HOME/.history"
 export HISTCONTROL=ignoreboth:erasedups
@@ -218,4 +192,31 @@ __prompt () {
 
 # shellcheck disable=SC1090
 . "$HOME/Documents/Shore/bundle_certs/bundle_certs"
+
+if [ -n "${BASH:-}" ]
+then
+    shopt -s histappend
+    shopt -s checkwinsize
+    shopt -s cmdhist
+    export PROMPT_COMMAND="history -a"
+    [ -f /etc/bash_completion ] && . /etc/bash_completion
+
+    # shellcheck disable=SC1090
+    for sourcefile in $HOME/.bash_completion.d/*
+    do
+        [ ! -f "$sourcefile" ] || . "$sourcefile"
+    done
+fi
+
+# make less more friendly for non-text input files, see lesspipe(1)
+[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
+
+# enable color support of ls and also add handy aliases
+if [ -x /usr/bin/dircolors ]; then
+    eval "$(dircolors -b)"
+    alias ls='ls --color=auto'
+    alias grep='grep --color=auto'
+    alias diff='diff --color=auto'
+fi
+
 prune_prerun