From f8759897293de64c101a69bec3af2705b7c84902 Mon Sep 17 00:00:00 2001 From: Mehdi Sadeghi Date: Tue, 7 Jun 2022 08:06:48 +0200 Subject: 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. --- .bashrc | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to '.bashrc') 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 -- cgit v1.2.3