From d91bd8454d96aec1948bbc0808418aa0f92f5246 Mon Sep 17 00:00:00 2001 From: Mehdi Sadeghi Date: Thu, 27 May 2021 10:26:23 +0200 Subject: Add bash direnv hook for blue032. --- .bashrc | 2 +- .config/blue032.profile | 11 +++++++++++ .zprofile | 6 ------ 3 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 .config/blue032.profile diff --git a/.bashrc b/.bashrc index a148f44..c0326c2 100644 --- a/.bashrc +++ b/.bashrc @@ -1,4 +1,4 @@ -[ -n "$ENV" ] && . "$ENV" || [ -e .env ] && . .env +[ -n "$ENV" ] && . "$ENV" || [ -e ~/.env ] && . ~/.env export PS1="\[\033[1;33m\]\u@\h:\W\$ \[\033[0m\]" diff --git a/.config/blue032.profile b/.config/blue032.profile new file mode 100644 index 0000000..b759bfd --- /dev/null +++ b/.config/blue032.profile @@ -0,0 +1,11 @@ + +_direnv_hook() { + local previous_exit_status=$?; + trap -- '' SIGINT; + eval "$("/usr/bin/direnv" export bash)"; + trap - SIGINT; + return $previous_exit_status; +}; +if ! [[ "${PROMPT_COMMAND:-}" =~ _direnv_hook ]]; then + PROMPT_COMMAND="_direnv_hook${PROMPT_COMMAND:+;$PROMPT_COMMAND}" +fi diff --git a/.zprofile b/.zprofile index 886e1b6..0504057 100644 --- a/.zprofile +++ b/.zprofile @@ -7,9 +7,3 @@ emulate sh -c '. ~/.profile' # Clone oh-my-zsh if not present. test ! -e ~/.oh-my-zsh && git clone https://github.com/ohmyzsh/ohmyzsh .oh-my-zsh -# Run and configure ssh-agent -if ! pgrep -u "$USER" ssh-agent > /dev/null; then - ssh-agent -t 1h > "$XDG_RUNTIME_DIR/ssh-agent.env" -fi -source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null - -- cgit v1.2.3