I switched to zsh from bash many years ago.
Today, I like to share a few tips on using zsh, and those are included in my dotfiles.
How to SKIP a cmdline from .zsh_history
$ echo "This cmdline saved in history."
$ echo "This cmdline will not be saved in history (bcos of leading space. Try it."
Show datetime and elapsed times in history
I would like to show the datetime and the elapsed time of my cmdline in my history. Thus I modified the alias in my .zshrc:
alias history='history -i -D 0'
Where -i is for datetime in iso-format, -D is for showing elapsed times spent, and 0 is for showing all the history.
To show history from all the login terminals
I do open multiple terminals for work, and I would like to see the history of cmdline from all the terminals. Thus I enable the setopt in my .zshrc:
setopt share_history