4 ms·
I have a one-liner zsh function that does the same thing, been using it for years, too powerful for me to switch it, and probably has better search capabilities
by yagizdegirmenci 3y ago
I have a one-liner zsh function that does the same thing, been using it for years, too powerful for me to switch it, and probably has better search capabilities, thanks to fzf.
function hist() {
print -z $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf | sed -E 's/ *[0-9]*\*? *//' | sed -E 's/\\/\\\\/g')
}
- cstrahan 3y ago"I have a one-liner zsh function that does the same thing" I think you mean "I have a one-liner zsh function that does a tiny subset". It's lacking: - The ability to filter by current directory - The ability to filter by current shell session, instead of across all shell sessions (that's assuming you use zsh's shared_history; if not, then the opposite is true: you can only search within the current shell session. See https://zsh.sourceforge.io/Doc/Release/Options.html#index-SHARE_005fHISTORY https://zsh.sourceforge.io/Doc/Release/Options.html#index-SH...) - Search history across hosts Until recently, I used zsh+fzf, with the default ctrl+r binding replacement provided by fzf. It's been great, but it has lacked functionality that I've wanted for a while now. Atuin fills in these gaps for me.
- theshrike79 3y agoNow use your function to give you a list of all find commands that took over 10 seconds to run. Atuin stores _everything_ it can about each command run, what you see when you press C-r is only a tiny subset. And even it gives you the duration and success/failure information immediately. If you want to, try pressing C-r, select a command from history and press C-o. Normal shell history doesn't store any of that.