summaryrefslogtreecommitdiff
path: root/.bashrc
diff options
context:
space:
mode:
authorMehdi Sadeghi <mehdi@mehdix.org>2022-06-07 08:06:48 +0200
committerMehdi Sadeghi <mehdi@mehdix.org>2022-06-07 08:57:56 +0200
commitf8759897293de64c101a69bec3af2705b7c84902 (patch)
treee5734dccee1b500acbdd8ce6b36d38873521da7b /.bashrc
parentdbb661005d7e6ccc0e33316323d02d60062be9a0 (diff)
Separate sh history. Add hist count to prompt.
sh history is written to ~/.sh_history now. The reason is that I am chasing the cause of a history truncation issue.
Diffstat (limited to '.bashrc')
-rw-r--r--.bashrc24
1 files changed, 20 insertions, 4 deletions
diff --git a/.bashrc b/.bashrc
index 56b7e73..99884a3 100644
--- a/.bashrc
+++ b/.bashrc
@@ -1,17 +1,21 @@
-echo .bashrc begin
# .bashrc
+echo .bashrc begin
+
+# Load ENV file (shared with POSIX shell)
[ $0 != sh ] && [ -n "${ENV:=$HOME/.env}" ] && . "$ENV"
PS1='\[\033[1;33m\]$($HOME/.local/bin/prompt)\[\033[0m\]'
-HISTCONTROL=ignoreboth:erasedups
+
+# Bash history config
+HISTSIZE=65535
+HISTFILE=$HOME/.bash_history
+HISTCONTROL=ignoreboth
HISTIGNORE="gst"
# see man strftime
HISTTIMEFORMAT="%F "
-
# Uncomment this line and remove `histappend' to enable shared history.
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r;"
#shopt -s histappend
-
# Enable recursive search including hidden subs
shopt -s globstar dotglob
@@ -28,4 +32,16 @@ complete -D -F _completion_loader -o bashdefault -o default
[ -f ~/.config/broot/launcher/bash/br ] && . ~/.config/broot/launcher/bash/br
[ -f ~/.local/src/z.sh ] && . ~/.local/src/z.sh
+# direnv
+_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
+
echo .bashrc end