Created
January 19, 2014 08:29
-
-
Save Genki-S/8501974 to your computer and use it in GitHub Desktop.
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
function exists { which $1 &> /dev/null } | |
if exists percol; then | |
function percol_select_history() { | |
local tac | |
exists gtac && tac="gtac" || { exists tac && tac="tac" || { tac="tail -r" } } | |
BUFFER=$(fc -l -n 1 | eval $tac | percol --query "$LBUFFER") | |
CURSOR=$#BUFFER # move cursor | |
zle -R -c # refresh | |
} | |
zle -N percol_select_history | |
bindkey '^R' percol_select_history | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment