Compare commits
No commits in common. "d67b07d275c33ab2f5592cdc14e53d4889429a55" and "b66b03bc782351329e4c689e96b3abcb88fb7d29" have entirely different histories.
d67b07d275
...
b66b03bc78
91
bash/.bashrc
91
bash/.bashrc
@ -1,41 +1,5 @@
|
||||
#{- ~/.bashrc -}#
|
||||
|
||||
#{- SOURCING -}#
|
||||
|
||||
# Source profile, if it hasn't already been loaded
|
||||
if [ -z "$__PROFILE_DONE" ]; then
|
||||
. $HOME/.profile
|
||||
fi
|
||||
|
||||
# Source .env to extend with secret/sensitive environment variables if it exists
|
||||
if [ -r "$HOME/.env" ]; then
|
||||
. "$HOME/.env"
|
||||
fi
|
||||
|
||||
if [ -r "$HOME/.config/xdg/env" ]; then
|
||||
. "$HOME/.config/xdg/env"
|
||||
fi
|
||||
|
||||
# Source aliases, if they exist
|
||||
if [ -f "$HOME/.aliases" ] && [ -r "$HOME/.aliases" ]; then
|
||||
. "$HOME/.aliases"
|
||||
fi
|
||||
|
||||
# Source private aliases, if they exist
|
||||
if [ -f "$HOME/.private_aliases" ] && [ -r "$HOME/.private_aliases" ]; then
|
||||
. "$HOME/.private_aliases"
|
||||
fi
|
||||
|
||||
# Source functions, if they exist
|
||||
if [ -f "$HOME/.functions" ] && [ -r "$HOME/.functions" ]; then
|
||||
. "$HOME/.functions"
|
||||
fi
|
||||
|
||||
# Source private functions, if they exist
|
||||
if [ -f "$HOME/.private_functions" ] && [ -r "$HOME/.private_functions" ]; then
|
||||
. "$HOME/.private_functions"
|
||||
fi
|
||||
|
||||
#{- PROMPT -}#
|
||||
|
||||
if which tput &> /dev/null && tput bold &> /dev/null; then
|
||||
@ -56,6 +20,7 @@ else
|
||||
no_color="\[\033[0m\]"
|
||||
fi
|
||||
|
||||
|
||||
export PS1="${green}"'\$'"${no_color} "
|
||||
export DIRENV_PS1="${red}"'\$'"${no_color} "
|
||||
export NIX_SHELL_PS1="${blue}"'λ'"${no_color} "
|
||||
@ -90,7 +55,7 @@ if which direnv &> /dev/null; then
|
||||
PS1=${ORIG_PS1}
|
||||
fi
|
||||
}
|
||||
prompt_command_prepend update_prompt
|
||||
PROMPT_COMMAND="update_prompt; $PROMPT_COMMAND"
|
||||
fi
|
||||
|
||||
# Continuation Prompt: "> " in cyan
|
||||
@ -100,10 +65,7 @@ export PS4="${blue}#${no_color} "
|
||||
|
||||
#{- HISTORY -}#
|
||||
|
||||
prompt_command_prepend "history -r"
|
||||
prompt_command_prepend "history -c"
|
||||
prompt_command_prepend "history -w"
|
||||
prompt_command_prepend "history -n"
|
||||
PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
|
||||
# PROMPT_COMMAND="echo hist1; history; history -n; echo hist2; history; history -w; echo hist3; history; history -c; echo hist4; history; history -r; echo hist5; history; $PROMPT_COMMAND"
|
||||
export HISTFILE="$HOME/.history/bash"
|
||||
export HISTTIMEFORMAT="%F %T "
|
||||
@ -131,9 +93,46 @@ log_bash_persistent_history()
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_command_prepend "log_bash_persistent_history"
|
||||
PROMPT_COMMAND="log_bash_persistent_history; $PROMPT_COMMAND"
|
||||
|
||||
|
||||
#{- SOURCING -}#
|
||||
|
||||
|
||||
# Source profile, if it hasn't already been loaded
|
||||
if [ -z "$__PROFILE_DONE" ]; then
|
||||
. $HOME/.profile
|
||||
fi
|
||||
|
||||
# Source .env to extend with secret/sensitive environment variables if it exists
|
||||
if [ -r "$HOME/.env" ]; then
|
||||
. "$HOME/.env"
|
||||
fi
|
||||
|
||||
if [ -r "$HOME/.config/xdg/env" ]; then
|
||||
. "$HOME/.config/xdg/env"
|
||||
fi
|
||||
|
||||
# Source aliases, if they exist
|
||||
if [ -f "$HOME/.aliases" ] && [ -r "$HOME/.aliases" ]; then
|
||||
. "$HOME/.aliases"
|
||||
fi
|
||||
|
||||
# Source private aliases, if they exist
|
||||
if [ -f "$HOME/.private_aliases" ] && [ -r "$HOME/.private_aliases" ]; then
|
||||
. "$HOME/.private_aliases"
|
||||
fi
|
||||
|
||||
# Source functions, if they exist
|
||||
if [ -f "$HOME/.functions" ] && [ -r "$HOME/.functions" ]; then
|
||||
. "$HOME/.functions"
|
||||
fi
|
||||
|
||||
# Source private functions, if they exist
|
||||
if [ -f "$HOME/.private_functions" ] && [ -r "$HOME/.private_functions" ]; then
|
||||
. "$HOME/.private_functions"
|
||||
fi
|
||||
|
||||
# Source bash completion, this file will then lazy load all other completions
|
||||
source_completions() {
|
||||
if [ -r "/usr/share/bash-completion/bash_completion" ]; then
|
||||
@ -159,12 +158,8 @@ preserve_xtrace_reset() {
|
||||
fi
|
||||
} 2>/dev/null
|
||||
|
||||
prompt_command_prepend preserve_xtrace
|
||||
prompt_command_append preserve_xtrace_reset
|
||||
PROMPT_COMMAND="preserve_xtrace; $PROMPT_COMMAND preserve_xtrace_reset"
|
||||
|
||||
if $(which direnv &> /dev/null); then
|
||||
# Only if direnv isn't already defined in our prompt_command
|
||||
if ! grep -q _direnv_hook <<< $PROMPT_COMMAND; then
|
||||
eval "$(direnv hook bash)"
|
||||
fi
|
||||
eval "$(direnv hook bash)"
|
||||
fi
|
||||
|
||||
@ -64,13 +64,3 @@ git_prompt()
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_command_append() {
|
||||
arg=${1}
|
||||
PROMPT_COMMAND=${PROMPT_COMMAND:+"$PROMPT_COMMAND; "}"${arg}"
|
||||
}
|
||||
|
||||
prompt_command_prepend() {
|
||||
arg=${1}
|
||||
PROMPT_COMMAND="${arg}"${PROMPT_COMMAND:+"; $PROMPT_COMMAND"}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user