diff options
| -rw-r--r-- | .bashrc | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -4,6 +4,28 @@ # Source global definitions [ -f /etc/bashrc ] && . /etc/bashrc +# When running nix develop you get your interactive bash shell, however the +# $SHELL variable is set to the non-interactive bash +# This variable change happens after .bashrc sourcing +# As an awful workaround, only on the first PROMPT_COMMAND after a new shell +# is started, we check and fix $SHELL +shell_var_fix() { + if [ -x '/run/current-system/sw/bin/bash' ] && \ + [[ "$SHELL" =~ /nix/store.*-bash-[[:digit:]].* ]] + then + export SHELL='/run/current-system/sw/bin/bash' + fi + + # Don't ever run this function again + export PROMPT_COMMAND="${PROMPT_COMMAND#shell_var_fix;}" + unset -f shell_var_fix +} +# This has a second purpose, to reset PROMPT_COMMAND, since subshells would +# inherit it from the parent and inside the Prompt we prepend it +# However, without this workaround, we wouldn't need to prepend in the first +# place +export PROMPT_COMMAND="shell_var_fix;" + # Prompt {{{ [ "$(tput colors)" -ge 256 ]; _hc=$? hc_mode() { return $_hc ; } @@ -190,7 +212,7 @@ # export PS0=" $(left_cap 'o' "$PS_TRIANGLE_BOT") \A$(right_cap)\n\$(kill -s SIGUSR2 $$)" export PS0="\$(kill -s SIGUSR2 $$)" - export PROMPT_COMMAND='EXSTAT="$?";seconds="$SECONDS";___changes="";___git_printed="";'$PS_COMM';___dirchanged=''; ___timer="n"' + export PROMPT_COMMAND="$PROMPT_COMMAND"'EXSTAT="$?";seconds="$SECONDS";___changes="";___git_printed="";'$PS_COMM';___dirchanged=''; ___timer="n"' # }}} # vi mode {{{ |
