diff --git a/yashrc b/yashrc index 4ad4ce1..4e816e3 100644 --- a/yashrc +++ b/yashrc @@ -10,12 +10,14 @@ if command --identify --builtin-command bindkey >/dev/null; then set --emacs fi -# set history +# arrange history HISTFILE= HISTSIZE=5000 HISTRMDUP=5000 +histstart=$(mktemp) history -r "$HOME/.yash_history" -trap 'h=$(mktemp) && history -w $h && history -c && history -r "$HOME/.yash_history" && history -r $h && history -w $HOME/.yash_history && rm $h' EXIT +history -w "$histstart" +trap "history -w - | diff --old-line-format='' '$histstart' - > '$HOME/.yash_history' && rm '$histstart'" EXIT # Get ourselves a nice prompt ks() { s="$?" ; $* ; return "$s" ; } @@ -75,6 +77,8 @@ alias unlock='gpg-connect-agent <<