Skip to content

Instantly share code, notes, and snippets.

@dohq
Last active September 21, 2018 15:27
Show Gist options
  • Save dohq/73da4a46fc1a18719b54e894c6076a18 to your computer and use it in GitHub Desktop.
Save dohq/73da4a46fc1a18719b54e894c6076a18 to your computer and use it in GitHub Desktop.
peco-history.zsh
#bindkey '^R' history-incremental-pattern-search-backward
setopt hist_ignore_all_dups
function peco_select_history() {
local tac
if which tac > /dev/null; then
tac="tac"
else
tac="tail -r"
fi
BUFFER
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