Skip to content

Instantly share code, notes, and snippets.

@nacyot
Last active October 11, 2018 15:35
Show Gist options
  • Save nacyot/2c9151f2274ccad8bffc to your computer and use it in GitHub Desktop.
Save nacyot/2c9151f2274ccad8bffc to your computer and use it in GitHub Desktop.
# http://qiita.com/uchiko/items/f6b1528d7362c9310da0
function peco-select-history() {
local tac
if which tac > /dev/null; then
tac="tac"
else
tac="tail -r"
fi
BUFFER=$(\history -n 1 | \
eval $tac | \
peco --query "$LBUFFER")
CURSOR=$#BUFFER
zle clear-screen
}
zle -N peco-select-history
bindkey '^r' peco-select-history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment