Created
April 3, 2015 17:51
-
-
Save ay65535/1b4f73ffd029f51a9959 to your computer and use it in GitHub Desktop.
peco-select-history 複数行のコマンドにも対応版
This file contains hidden or 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 peco-select-history() { | |
local buffer | |
local sep='¶' | |
buffer=$( | |
history -nr $'\n'=$sep 1 | \ | |
peco --layout=bottom-up --query "$LBUFFER" | \ | |
sed s/$sep/\\$'\n'/g) | |
if [[ ! -z buffer ]]; then | |
BUFFER=$buffer | |
fi | |
CURSOR=$#BUFFER | |
zle redisplay | |
} | |
zle -N peco-select-history | |
bindkey '^r' peco-select-history |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment