2015-12-15 00:12:17 -05:00
|
|
|
|
#
|
|
|
|
|
# Configures history options
|
|
|
|
|
#
|
|
|
|
|
|
2018-12-08 14:06:22 -05:00
|
|
|
|
# The file to save the history in.
|
2015-12-19 09:48:29 -05:00
|
|
|
|
HISTFILE="${ZDOTDIR:-${HOME}}/.zhistory"
|
2015-12-15 00:12:17 -05:00
|
|
|
|
|
2018-12-08 14:06:22 -05:00
|
|
|
|
# The maximum number of events stored in the internal history list and in the history file.
|
2015-12-15 00:12:17 -05:00
|
|
|
|
HISTSIZE=10000
|
|
|
|
|
SAVEHIST=10000
|
|
|
|
|
|
|
|
|
|
# Perform textual history expansion, csh-style, treating the character ‘!’ specially.
|
|
|
|
|
setopt BANG_HIST
|
|
|
|
|
|
2018-12-08 14:06:22 -05:00
|
|
|
|
# This option both imports new commands from the history file, and also causes your
|
|
|
|
|
# typed commands to be appended to the history file (like specifying INC_APPEND_HISTORY).
|
|
|
|
|
# The history lines are also output with timestamps ala EXTENDED_HISTORY.
|
2015-12-15 00:12:17 -05:00
|
|
|
|
setopt SHARE_HISTORY
|
|
|
|
|
|
|
|
|
|
# Do not enter command lines into the history list if they are duplicates of the previous event.
|
|
|
|
|
setopt HIST_IGNORE_DUPS
|
|
|
|
|
|
2018-12-08 14:06:22 -05:00
|
|
|
|
# If a new command line being added to the history list duplicates an older one,
|
2015-12-15 00:12:17 -05:00
|
|
|
|
# the older command is removed from the list (even if it is not the previous event).
|
|
|
|
|
setopt HIST_IGNORE_ALL_DUPS
|
|
|
|
|
|
2018-12-08 14:06:22 -05:00
|
|
|
|
# Remove command lines from the history list when the first character on the
|
|
|
|
|
# line is a space, or when one of the expanded aliases contains a leading space.
|
2015-12-15 00:12:17 -05:00
|
|
|
|
setopt HIST_IGNORE_SPACE
|
|
|
|
|
|
|
|
|
|
# When writing out the history file, older commands that duplicate newer ones are omitted.
|
|
|
|
|
setopt HIST_SAVE_NO_DUPS
|
|
|
|
|
|
2018-12-08 14:06:22 -05:00
|
|
|
|
# Whenever the user enters a line with history expansion, don't execute the line directly;
|
2015-12-15 00:12:17 -05:00
|
|
|
|
# instead, perform history expansion and reload the line into the editing buffer.
|
|
|
|
|
setopt HIST_VERIFY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Lists the ten most used commands.
|
|
|
|
|
alias history-stat="history 0 | awk '{print \$2}' | sort | uniq -c | sort -n -r | head"
|