Created
May 26, 2018 08:07
-
-
Save slonoed/d3991c57add516d2ebaca78e8e7da5ba to your computer and use it in GitHub Desktop.
Fuzzy find and execute command from history
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fuzzy history | |
hist() { | |
local cmd | |
cmd=$(history | sed -E 's/[0-9]+\ \ //g' | sort -u | grep '^[^\ ]' | fzf --no-multi) && | |
echo "\$ $cmd" && | |
command $cmd | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment