Skip to content

Instantly share code, notes, and snippets.

@sugyan
Created June 5, 2014 08:50
Show Gist options
  • Save sugyan/03af41390bbb2e2c09b0 to your computer and use it in GitHub Desktop.
Save sugyan/03af41390bbb2e2c09b0 to your computer and use it in GitHub Desktop.
function percol_select_directory() {
local tac
if which tac > /dev/null; then
tac="tac"
else
tac="tail -r"
fi
local dest=$(_z -r 2>&1 | eval $tac | percol --query "$LBUFFER" | awk '{ print $2 }')
if [ -n "${dest}" ]; then
cd ${dest}
fi
zle reset-prompt
}
zle -N percol_select_directory
bindkey "^X^J" percol_select_directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment