diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 9f7758c..e82ce7b 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -11,6 +11,23 @@ setopt AUTO_CD AUTO_PUSHD PUSHD_IGNORE_DUPS PUSHD_MINUS # Various options setopt CORRECT_ALL FLOW_CONTROL INTERACTIVE_COMMENTS LONG_LIST_JOBS +############################# History ########################################## +export HISTSIZE=50000 # In memory. +export SAVEHIST=10000 # On disk. +# Write command to history file after it is finished, with time and duration. +setopt NO_SHARE_HISTORY EXTENDED_HISTORY INC_APPEND_HISTORY_TIME +# setopt NO_INC_APPEND_HISTORY_TIME EXTENDED_HISTORY SHARE_HISTORY +setopt HIST_EXPIRE_DUPS_FIRST HIST_IGNORE_DUPS +setopt HIST_IGNORE_SPACE HIST_REDUCE_BLANKS HIST_VERIFY + +# Import new commands from the history file +function _my_history_prexec() +{ + fc -RI +} +autoload -Uz add-zsh-hook +add-zsh-hook preexec _my_history_prexec + ############################## Plugins ######################################### # Hyphen-insensitive completion. Case sensitive completion must be off. _ and - @@ -59,23 +76,6 @@ zstyle ':fzf-tab:complete:man:*' fzf-preview 'whatis -l $word | cut -d- -f2,3,4, async_init -############################# History ########################################## -export HISTSIZE=50000 # In memory. -export SAVEHIST=10000 # On disk. -# Write command to history file after it is finished, with time and duration. -setopt NO_SHARE_HISTORY EXTENDED_HISTORY INC_APPEND_HISTORY_TIME -# setopt NO_INC_APPEND_HISTORY_TIME EXTENDED_HISTORY SHARE_HISTORY -setopt HIST_EXPIRE_DUPS_FIRST HIST_IGNORE_DUPS -setopt HIST_IGNORE_SPACE HIST_REDUCE_BLANKS HIST_VERIFY - -# Import new commands from the history file -function _precmd_history -{ - fc -R - # fc -RI -} -precmd_functions+=_precmd_history - ############################## Completion ###################################### setopt ALWAYS_TO_END COMPLETE_IN_WORD