From 6cac28b246f458f636e19aed81443ad510c7e341 Mon Sep 17 00:00:00 2001 From: tastytea Date: Wed, 23 Mar 2022 23:29:37 +0100 Subject: [PATCH] Zsh: Move history stuff higher, fix incremental history add MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With calling fc -RI as preexec hook it should work. No, I don't know why. 🤷 --- .config/zsh/.zshrc | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) 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