Last active
August 29, 2015 14:01
-
-
Save harai/91c87437b18331e51a23 to your computer and use it in GitHub Desktop.
ライフチェンジングなpercolとautojumpの紹介 - 404 Engineer Logs http://blog.zoncoen.net/blog/2014/01/14/percol-autojump-with-zsh/ のUbuntu 14.04対応版
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 | |
BUFFER=$(history | sed -e "s/^\\s*[0-9]*\\s*\\*\?\\s*//g" | 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