Skip to content

Instantly share code, notes, and snippets.

@CarloCattano
Last active November 30, 2022 12:23
Show Gist options
  • Save CarloCattano/834ed396059acc8c5dc9e7857eb268ab to your computer and use it in GitHub Desktop.
Save CarloCattano/834ed396059acc8c5dc9e7857eb268ab to your computer and use it in GitHub Desktop.
Ignore duplicates and wrong commands on zsh-autosuggestions and dont add it to .zsh_history

add this lines somewhere on your ~/.zshrc

setopt EXTENDED_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_FIND_NO_DUPS
setopt HIST_SAVE_NO_DUPS
setopt HIST_BEEP

# Ignore failed wrong commands
zshaddhistory() { whence ${${(z)1}[1]} >| /dev/null || return 1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment