Last active
September 21, 2018 15:27
-
-
Save dohq/73da4a46fc1a18719b54e894c6076a18 to your computer and use it in GitHub Desktop.
peco-history.zsh
This file contains 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
#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