Skip to content

Instantly share code, notes, and snippets.

@operando
Last active November 13, 2016 02:53
Show Gist options
  • Save operando/250da59cc97d89c33337fe5b129e09f5 to your computer and use it in GitHub Desktop.
Save operando/250da59cc97d89c33337fe5b129e09f5 to your computer and use it in GitHub Desktop.
peco select adb history
# adb history
function peco-select-adb-history() {
local tac
if which tac > /dev/null; then
tac="tac"
else
tac="tail -r"
fi
BUFFER=$(\history -n 1 | \
eval $tac | \
grep adb | \
peco --query "$LBUFFER")
CURSOR=$#BUFFER
zle clear-screen
}
zle -N peco-select-adb-history
bindkey '^a' peco-select-adb-history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment