Last active
October 29, 2017 10:42
-
-
Save lapis-zero09/51d3d15503f07960eb2938ee1b38c2e6 to your computer and use it in GitHub Desktop.
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
function history-fzf() { | |
local tac | |
if which tac > /dev/null; then | |
tac="tac" | |
else | |
tac="tail -r" | |
fi | |
BUFFER=$(history -n 1 | eval $tac | fzf --query "$LBUFFER") | |
CURSOR=$#BUFFER | |
zle reset-prompt | |
} | |
zle -N history-fzf | |
bindkey '^r' history-fzf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment