add direnv hook directly into .bashrc

main
Andrew Coleman 2021-05-11 12:35:00 -04:00
parent d12ded88f4
commit f553731438
2 changed files with 10 additions and 3 deletions

View File

@ -1,11 +1,14 @@
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# start in home directory
# shellcheck disable=SC2164
if [ "$PWD" != "$HOME" ] && [ "$PWD" -ef "$HOME" ] ; then cd ; fi
# change $HOME on FreeBSD to /usr/home/andrew
# shellcheck disable=SC2164
if [ -d "/usr$HOME" ] ; then export HOME=/usr$HOME ; cd ; fi
# load system bashrc
for BASHRC in /etc/bashrc /etc/bash.bashrc /etc/bash/bashrc ; do
if [ -f "$BASHRC" ] ; then
# shellcheck source=/dev/null
@ -14,8 +17,10 @@ for BASHRC in /etc/bashrc /etc/bash.bashrc /etc/bash/bashrc ; do
done
unset BASHRC
# this assumes nvim is always installed for $EDITOR
EDITOR=nvim; export EDITOR
# local paths
if ! [[ "$PATH" =~ $HOME/.local/bin:$HOME/bin: ]]
then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
@ -31,5 +36,9 @@ if [ -d ~/.bashrc.d ]; then
fi
done
fi
unset rc
# direnv hook
if which direnv > /dev/null 2>&1 ; then
eval "$(direnv hook bash)"
fi

View File

@ -1,2 +0,0 @@
#!/usr/bin/env bash
eval "$(direnv hook bash)"