Skip to content

Instantly share code, notes, and snippets.

@lapis-zero09
Last active October 29, 2017 10:42
Show Gist options
  • Save lapis-zero09/51d3d15503f07960eb2938ee1b38c2e6 to your computer and use it in GitHub Desktop.
Save lapis-zero09/51d3d15503f07960eb2938ee1b38c2e6 to your computer and use it in GitHub Desktop.
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