2024-03-22 23:22:47 +03:00

26 lines
1.1 KiB
Plaintext

# History configurations
export HISTFILE="$HOME/.zsh_history"
export HISTSIZE=100000
export SAVEHIST=$HISTSIZE
setopt HIST_VERIFY # Don't execute immediately upon history expansion.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file.
export HISTORY_IGNORE='(cd|c|q|exit|l[sal.]|[bf]g#( *)#|..|lsl|ll[a.]|cd ..)'
# configure `time` format
TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'
zshaddhistory() {
emulate -L zsh
## uncomment if HISTORY_IGNORE
## should use EXTENDED_GLOB syntax
setopt extendedglob
[[ ${1::-1} != ${~HISTORY_IGNORE} ]]
}