Skip to content

Commit a2d87f2

Browse files
committed
fix(bling): initialize direnv for bash and zsh
- Add direnv hook initialization before bash-preexec - Fixes PROMPT_COMMAND conflicts that break atuin history - Enables direnv functionality out-of-the-box - See: rcaloras/bash-preexec#143
1 parent d0655a9 commit a2d87f2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/ublue-bling/src/bling.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,21 @@ HOMEBREW_PREFIX="${HOMEBREW_PREFIX:-/home/linuxbrew/.linuxbrew}"
3232
ATUIN_INIT_FLAGS=${ATUIN_INIT_FLAGS:-""}
3333

3434
if [ "$(basename $(readlink /proc/$$/exe))" = "bash" ]; then
35+
# Initialize direnv before bash-preexec to avoid PROMPT_COMMAND conflicts
36+
# See: https://github.com/rcaloras/bash-preexec/pull/143
37+
[ "$(command -v direnv)" ] && eval "$(direnv hook bash)"
3538
[ -f "/etc/profile.d/bash-preexec.sh" ] && . "/etc/profile.d/bash-preexec.sh"
3639
[ -f "/usr/share/bash-prexec" ] && . "/usr/share/bash-prexec"
3740
[ -f "/usr/share/bash-prexec.sh" ] && . "/usr/share/bash-prexec.sh"
3841
[ -f "${HOMEBREW_PREFIX}/etc/profile.d/bash-preexec.sh" ] && . "${HOMEBREW_PREFIX}/etc/profile.d/bash-preexec.sh"
3942
# Initialize atuin before starship to ensure proper command history capture
40-
# See: https://github.com/atuinsh/atuin/issues/2804
43+
# See: https://github.com/atuinsh/atuin/issues/2804
4144
[ "$(command -v atuin)" ] && eval "$(atuin init bash ${ATUIN_INIT_FLAGS})"
4245
[ "$(command -v starship)" ] && eval "$(starship init bash)"
4346
[ "$(command -v zoxide)" ] && eval "$(zoxide init bash)"
4447
elif [ "$(basename $(readlink /proc/$$/exe))" = "zsh" ]; then
48+
# Initialize direnv before atuin to avoid PROMPT_COMMAND conflicts
49+
[ "$(command -v direnv)" ] && eval "$(direnv hook zsh)"
4550
# Initialize atuin before starship to ensure proper command history capture
4651
[ "$(command -v atuin)" ] && eval "$(atuin init zsh ${ATUIN_INIT_FLAGS})"
4752
[ "$(command -v starship)" ] && eval "$(starship init zsh)"

0 commit comments

Comments
 (0)