From f553731438d8c89f99ea6d1604c676533b8e2ebb Mon Sep 17 00:00:00 2001 From: Andrew Coleman Date: Tue, 11 May 2021 12:35:00 -0400 Subject: [PATCH] add direnv hook directly into .bashrc --- dot_bashrc | 11 ++++++++++- private_dot_bashrc.d/direnv.sh | 2 -- 2 files changed, 10 insertions(+), 3 deletions(-) delete mode 100644 private_dot_bashrc.d/direnv.sh diff --git a/dot_bashrc b/dot_bashrc index 9b8f2f0..433f574 100644 --- a/dot_bashrc +++ b/dot_bashrc @@ -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 diff --git a/private_dot_bashrc.d/direnv.sh b/private_dot_bashrc.d/direnv.sh deleted file mode 100644 index 7781a99..0000000 --- a/private_dot_bashrc.d/direnv.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -eval "$(direnv hook bash)"