4 zparseopts -E c=clear l=list
6 if [[ -n "$clear" ]]; then
7 # if -c provided, clobber the history file
10 echo >&2 History file deleted.
11 elif [[ -n "$list" ]]; then
12 # if -l provided, run as if calling `fc' directly
15 # unless a number is provided, show all history events (starting from 1)
16 [[ ${@[-1]-} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
21 case ${HIST_STAMPS-} in
22 "mm/dd/yyyy") alias history='omz_history -f' ;;
23 "dd.mm.yyyy") alias history='omz_history -E' ;;
24 "yyyy-mm-dd") alias history='omz_history -i' ;;
25 "") alias history='omz_history' ;;
26 *) alias history="omz_history -t '$HIST_STAMPS'" ;;
29 ## History file configuration
30 [ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
31 [ "$HISTSIZE" -lt 50000 ] && HISTSIZE=50000
32 [ "$SAVEHIST" -lt 10000 ] && SAVEHIST=10000
34 ## History command configuration
35 setopt extended_history # record timestamp of command in HISTFILE
36 setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
37 setopt hist_ignore_dups # ignore duplicated commands history list
38 setopt hist_ignore_space # ignore commands that start with space
39 setopt hist_verify # show command with history expansion to user before running it
40 setopt share_history # share command history data