1
0
Fork 0

Zsh: Move history stuff higher, fix incremental history add

With calling fc -RI as preexec hook it should work. No, I don't know
why. 🤷
This commit is contained in:
tastytea 2022-03-23 23:29:37 +01:00
parent d6eb4e3090
commit 6cac28b246
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
1 changed files with 17 additions and 17 deletions

View File

@ -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