Skip to content

Instantly share code, notes, and snippets.

@harai
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harai/91c87437b18331e51a23 to your computer and use it in GitHub Desktop.
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対応版
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