Set defaults for preserving zsh history.

master
Icedream 2020-09-30 10:20:20 +02:00
parent a915dd5920
commit aa8a1c6d72
Signed by: icedream
GPG Key ID: 1573F6D8EFE4D0CF
1 changed files with 18 additions and 0 deletions

View File

@ -23,6 +23,8 @@ ZSH_GPG_PINENTRY_FIX=${ZSH_GPG_PINENTRY_FIX:-1}
ZSH_LOGO_LS=${ZSH_LOGL_LS:-$(when_binary_available logo-ls)}
ZSH_PIPX=${ZSH_PIPX:-$(when_binary_available pipx)}
ZSH_POWERLINE="${ZSH_POWERLINE:-1}"
ZSH_PRESERVE_HISTORY="${ZSH_PRESERVE_HISTORY:-1}"
ZSH_PRESERVE_HISTORY_IMMEDIATELY="${ZSH_PRESERVE_HISTORY_IMMEDIATELY:-1}"
ZSH_PRINT_REBOOT_REQUIRED=${ZSH_PRINT_REBOOT_REQUIRED:-0} # hacky, see below
ZSH_SYNTAX_HIGHLIGHTING="${ZSH_SYNTAX_HIGHLIGHTING:-1}"
ZSH_THEFUCK=${ZSH_THEFUCK:-1}
@ -267,6 +269,22 @@ if [ $ZSH_PRINT_REBOOT_REQUIRED -gt 0 ]; then
fi
section_end
# Preserving zsh history
section "preserve zsh history"
if [ $ZSH_PRESERVE_HISTORY -gt 0 ]; then
: "${HISTFILE:=${HOME}/.zsh_history}"
: "${HISTSIZE:=10000}"
: "${SAVEHIST:=1000}"
if [ $ZSH_PRESERVE_HISTORY_IMMEDIATELY -gt 0 ]; then
# import new commands from the history file and also append typed commands to the history file immediately
setopt SHARE_HISTORY
else
# the history entry is written out to the file after the command is finished, so that the time taken by the command is recorded correctly in the history file in EXTENDED_HISTORY format
setopt INC_APPEND_HISTORY_TIME
fi
fi
section_end
# print env
section "Environment variables"
log "$(export)"