diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2024-04-22 01:19:35 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2024-04-22 01:19:35 -0300 |
commit | 3fb272147fb6ac839a107cfd19e3593bd35b38ea (patch) | |
tree | 7c66a7ded60b4c88fe4f2677ce539fc49f2448b1 /session.bash | |
parent | 66930d79eaf21d32124b10ecc396d9d629ffbd47 (diff) |
Diffstat (limited to 'session.bash')
-rw-r--r-- | session.bash | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/session.bash b/session.bash index 990966b..35eb7de 100644 --- a/session.bash +++ b/session.bash @@ -53,6 +53,20 @@ session() { false fi } + +# NOHIST handling - clear history on session exit +# FIXME: what happens if another plugin wants to hook EXIT?! (they get replaced/overridden - this could be a problem) +trap ' + if [[ "${HISTFILE#~/.bash_history.}" != "$HISTFILE" ]]; then + session="${HISTFILE#~/.bash_history.}" + sessioncwd="$(grep -s '\'' # '\''"$session"'\''$'\'' ~/.bash_session_cwd | tail -n 1)" + sessionflags="${sessioncwd% # *}" + sessionflags="${sessionflags##* # }" + if (eval "$sessionflags" && test -v NOHIST); then + history -c + fi + fi +' exit # setup completion for session(), using only builtins complete -C 'source <(printf "%s" '\'' set -- ~/.bash_history."$2"* |