Add support for custom timestamp format in history

This commit is contained in:
Cristian Consonni 2018-04-26 07:29:55 +02:00
commit 7f29de4726
No known key found for this signature in database
GPG key ID: 4467EF2D604D387C
2 changed files with 14 additions and 7 deletions

View file

@ -19,12 +19,16 @@ function omz_history {
}
# Timestamp format
case $HIST_STAMPS in
"mm/dd/yyyy") alias history='omz_history -f' ;;
"dd.mm.yyyy") alias history='omz_history -E' ;;
"yyyy-mm-dd") alias history='omz_history -i' ;;
*) alias history='omz_history' ;;
esac
if [ ! -z "$HIST_STAMPS" ]; then
case $HIST_STAMPS in
"mm/dd/yyyy") alias history='omz_history -f' ;;
"dd.mm.yyyy") alias history='omz_history -E' ;;
"yyyy-mm-dd") alias history='omz_history -i' ;;
*) alias history='omz_history -t "$HIST_STAMPS"' ;;
esac
else
alias history='omz_history'
fi
## History file configuration
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"