I have a global bash history, having set up bash/zsh to [immediately share without any annoying race conditions.][2] I use FZF mapped to CTRL+R to search through my history.
The unique thing is that I use a [python script (in my dotfiles)][1] to clean the history in a more advanced way than is possible with HISTIGNORE.
The script removes duplicates, leaving the most recent copy and removes lines matching several regexes.
If one is only interested to remove duplicates (your script does more) I've found this one liner in a StackExchange post:
awk '!x[$0]++' ~/.zsh_history
Note that this only keeps the first copy, not the most recent copy. To make it so that it only keeps the most recent, you would need to run this through `tac` twice.
The unique thing is that I use a [python script (in my dotfiles)][1] to clean the history in a more advanced way than is possible with HISTIGNORE.
The script removes duplicates, leaving the most recent copy and removes lines matching several regexes.
[1]: https://github.com/naggie/dotfiles/blob/master/scripts/clean... [2]: https://github.com/naggie/dotfiles/blob/master/home/.bashrc#...