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