Last active
November 6, 2015 19:10
-
-
Save KenshoFujisaki/3588982084e465d13110 to your computer and use it in GitHub Desktop.
zshで履歴をpeco実行
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
#------------------------------------------------------------------------------ | |
# 履歴 | |
#------------------------------------------------------------------------------ | |
alias his="fc -l -f 0 | sort -r | peco" | |
setopt extended_history | |
function peco-select-history() { | |
local tac | |
if which tac > /dev/null; then | |
tac="tac | uniq" | |
else | |
tac="tail -r | uniq" | |
fi | |
BUFFER=$(\history -n 1 | \ | |
eval $tac | \ | |
peco --query "$LBUFFER") | |
CURSOR=$#BUFFER | |
zle clear-screen | |
} | |
zle -N peco-select-history | |
bindkey '^R^H' peco-select-history |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment