improve yash history and add a haccounts alias

This commit is contained in:
Felix Van der Jeugt 2020-03-04 12:10:45 +01:00
parent 2cc389f7da
commit 7aaa8c2e61
No known key found for this signature in database
GPG Key ID: 58B209295023754D
1 changed files with 6 additions and 2 deletions

8
yashrc
View File

@ -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 <<<bye'
alias weechat="ssh -t weechat@Chatmachine abduco -A weechat"
alias agenda="khal list today 7d"
alias haccounts="hledger -I --alias '/.*:Accounts .*:(.*)/=Accounts:\1' bal accounts"
go() {
dir="$(lr /home /data /etc -t '(name ~~ ".*" && prune || print) && type = d && !(name = ".git")' \
| fzf --height 10 \