HIST_IGNORE_ALL_DUPS
will throw out all previous matches of the command, which can be confusing when using the history as a log of what you did later:
HIST_IGNORE_ALL_DUPS:
If a new command line being added to the history list duplicates an older one, the older command is removed from the list (even if it is not the previous event).
A closer fit to your needs is probably the HIST_FIND_NO_DUPS
option:
HIST_FIND_NO_DUPS:
When searching for history entries in the line editor, do not display duplicates of a line previously found, even if the duplicates are not contiguous.
Or maybe the HIST_IGNORE_DUPS
, but, as RichieHH notes, it also leads to an incomplete account of history:
HIST_IGNORE_DUPS:
Do not enter command lines into the history list if they are duplicates of the previous event.
See: man zshoptions | less -p History
.